fastlane-plugin-stream_actions 0.4.20 → 0.4.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 73f71f91d0a2144675bc921423e2553ea94a5a24e55d765daf131c5c2d4d1de0
4
- data.tar.gz: 5d5d416106e6677aa35911e2920681d98a781551e1026ef3a4914ccb3fa21ff8
3
+ metadata.gz: 4784999ab4dfa4274ec20304e8ff6f1e1228cc583a91e6ab4127a102cc34027f
4
+ data.tar.gz: 1853aa6c5258f011f768edbf4683dcca02b5081805c8d6e5e9169595e0e58272
5
5
  SHA512:
6
- metadata.gz: 4c2bd840b19ac480f21b907ab970cc9635bcfb65d3fc642fed006f6fa25b7dfded37f8688841ac6c410be97304dfe13e3c9d5cfd485d5479f209b62b057c1cef
7
- data.tar.gz: 475ab117be3640b57487110f424aed4a2cd6a10357697475181a04ab752778e5fec0d6e46b5735f85f9c4cb8461ce73f76e8f8a5901d92448f62ef11f273b2a0
6
+ metadata.gz: 9236659fd7094336030f5994005e57a71e7b4a1d693aa3cc9a918fefd8b01bcf17b09d1b3fb3c0ca8ed3c0527622c52ceb4a7181b2cce7f4e5fb62aaa5e951f5
7
+ data.tar.gz: 7527de60fc668057e9ed3b1231174ad7999e6390346c7d6f63966cb41efc27bff7e35d633788080da9c04dca043c3bd0b93f2b57936767588dca997477c02bd3
@@ -0,0 +1,50 @@
1
+ require 'shellwords'
2
+
3
+ module Fastlane
4
+ module Actions
5
+ class CloneInternalMetricsAction < Action
6
+ REPO = 'github.com/GetStream/stream-internal-metrics.git'.freeze
7
+
8
+ def self.run(params)
9
+ token = params[:github_token].to_s
10
+ # Without a token, keep the SSH URL that local runs rely on.
11
+ url = token.empty? ? "git@#{REPO.sub('/', ':')}" : "https://x-access-token:#{token}@#{REPO}"
12
+ UI.message("Cloning #{REPO} into #{params[:path]}")
13
+ # The URL can hold a token, so keep it out of the log and errors.
14
+ sh(
15
+ "git clone #{url.shellescape} #{params[:path].shellescape}",
16
+ print_command: false,
17
+ error_callback: ->(_) { UI.user_error!("Failed to clone #{REPO}") }
18
+ )
19
+ end
20
+
21
+ #####################################################
22
+ # @!group Documentation
23
+ #####################################################
24
+
25
+ def self.description
26
+ 'Clones GetStream/stream-internal-metrics, over HTTPS when a token is available'
27
+ end
28
+
29
+ def self.available_options
30
+ [
31
+ FastlaneCore::ConfigItem.new(
32
+ key: :path,
33
+ description: 'Directory to clone into'
34
+ ),
35
+ FastlaneCore::ConfigItem.new(
36
+ env_name: 'GITHUB_TOKEN',
37
+ key: :github_token,
38
+ description: 'Token with access to stream-internal-metrics. Without it, the SSH URL is used',
39
+ sensitive: true,
40
+ optional: true
41
+ )
42
+ ]
43
+ end
44
+
45
+ def self.is_supported?(platform)
46
+ true
47
+ end
48
+ end
49
+ end
50
+ end
@@ -27,7 +27,7 @@ module Fastlane
27
27
 
28
28
  # The current push does not touch :sources. It is only safe to skip if :sources were already
29
29
  # verified, i.e. all required checks passed on some commit that has the current :sources tree.
30
- is_check_required = self.required_due_to_history(params, required_checks)
30
+ is_check_required = self.required_due_to_history?(params, required_checks)
31
31
  UI.important("Check is required: #{is_check_required}")
32
32
  is_check_required
33
33
  end
@@ -39,7 +39,7 @@ module Fastlane
39
39
  # Walks the PR commits from newest to oldest. Every commit newer than the last :sources change
40
40
  # has the current :sources tree, so a passing run on any of them means :sources were verified.
41
41
  # The walk stops at the commit that changed :sources, since older commits have different sources.
42
- def self.required_due_to_history(params, required_checks)
42
+ def self.required_due_to_history?(params, required_checks)
43
43
  repo = (params[:github_repository] || ENV['GITHUB_REPOSITORY']).to_s
44
44
  if repo.empty?
45
45
  UI.important("No repository provided; cannot verify previous runs, running check")
@@ -6,7 +6,7 @@ module Fastlane
6
6
  is_push_to_base_branch = ENV['GITHUB_EVENT_NAME'].to_s == 'push' && other_action.current_branch == params[:base_branch]
7
7
  metrics_dir = 'metrics'
8
8
  FileUtils.remove_dir(metrics_dir, force: true)
9
- sh("git clone git@github.com:GetStream/stream-internal-metrics.git #{metrics_dir}")
9
+ other_action.clone_internal_metrics(path: metrics_dir)
10
10
 
11
11
  params[:sdk_names].each do |sdk|
12
12
  metrics_path = "metrics/linkmaps/#{sdk}.json"
@@ -40,7 +40,7 @@ module Fastlane
40
40
  header = "## #{sdk} XCSize"
41
41
  content = "#{header}\nNo changes in SDK size."
42
42
  unless differences.empty?
43
- sorted_differences = differences.sort_by { |_, diff| -diff.to_s.gsub(/[+\-]/, '').to_i }
43
+ sorted_differences = differences.sort_by { |_, diff| -diff.to_s.gsub(/[+-]/, '').to_i }
44
44
  content = "#{header}\n#{build_collapsible_table(sorted_differences.to_h)}"
45
45
  end
46
46
  UI.important(content)
@@ -58,7 +58,7 @@ module Fastlane
58
58
  else
59
59
  sh('git add -A')
60
60
  sh("git commit -m 'Update #{metrics_path}'")
61
- sh('git push')
61
+ Helper::MetricsHelper.push
62
62
  end
63
63
  end
64
64
  end
@@ -11,7 +11,7 @@ module Fastlane
11
11
  metrics_dir = 'metrics'
12
12
  FileUtils.remove_dir(metrics_dir, force: true)
13
13
  sdk_size_path = "#{metrics_dir}/#{params[:github_repo].split('/').last}-size.json"
14
- sh("git clone git@github.com:GetStream/stream-internal-metrics.git #{metrics_dir}/")
14
+ other_action.clone_internal_metrics(path: metrics_dir)
15
15
  is_release = other_action.current_branch.include?('release/')
16
16
  is_push_to_base_branch = ENV['GITHUB_EVENT_NAME'].to_s == 'push' && other_action.current_branch == params[:base_branch]
17
17
  benchmark_config = JSON.parse(File.read(sdk_size_path))
@@ -77,7 +77,7 @@ module Fastlane
77
77
  else
78
78
  sh('git add -A')
79
79
  sh("git commit -m 'Update #{sdk_size_path}'")
80
- sh('git push')
80
+ Helper::MetricsHelper.push
81
81
  end
82
82
  end
83
83
  end
@@ -8,7 +8,7 @@ module Fastlane
8
8
  upcoming_line = -1
9
9
  changes_since_last_release = ''
10
10
 
11
- File.open(params[:changelog_path]).each.with_index do |line, index|
11
+ file_data.each_with_index do |line, index|
12
12
  if upcoming_line != -1
13
13
  break if line.start_with?('# [')
14
14
 
@@ -28,9 +28,7 @@ module Fastlane
28
28
  file_data.insert(upcoming_line + 2, '### 🔄 Changed')
29
29
  file_data.insert(upcoming_line + 3, '')
30
30
 
31
- changelog = File.open(params[:changelog_path], 'w')
32
- changelog.puts(file_data)
33
- changelog.close
31
+ File.open(params[:changelog_path], 'w') { |changelog| changelog.puts(file_data) }
34
32
  UI.success("Successfully updated #{params[:changelog_path]}")
35
33
 
36
34
  changes_since_last_release
@@ -0,0 +1,30 @@
1
+ module Fastlane
2
+ module Helper
3
+ # Pushes commits to GetStream/stream-internal-metrics, which other repositories push to as well.
4
+ class MetricsHelper
5
+ # Rebases onto the latest metrics and pushes, retrying when another push got there first. Run it inside the
6
+ # metrics clone, after committing.
7
+ def self.push(attempts: 3)
8
+ 1.upto(attempts) do |attempt|
9
+ rebase
10
+ begin
11
+ return Actions.sh('git push')
12
+ rescue FastlaneCore::Interface::FastlaneShellError
13
+ raise if attempt == attempts
14
+
15
+ UI.important("Pushing to stream-internal-metrics was rejected, retrying (#{attempt}/#{attempts}).")
16
+ sleep(attempt * 5)
17
+ end
18
+ end
19
+ end
20
+
21
+ # A conflict isn't retried: it would fail again on the unfinished rebase and hide the conflict.
22
+ def self.rebase
23
+ Actions.sh('git pull --rebase')
24
+ rescue FastlaneCore::Interface::FastlaneShellError
25
+ Actions.sh('git rebase --abort', error_callback: ->(_) {})
26
+ raise
27
+ end
28
+ end
29
+ end
30
+ end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module StreamActions
3
- VERSION = '0.4.20'
3
+ VERSION = '0.4.22'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-stream_actions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.20
4
+ version: 0.4.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - GetStream
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-11-14 00:00:00.000000000 Z
11
+ date: 2026-11-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: xctest_list
@@ -142,14 +142,14 @@ dependencies:
142
142
  requirements:
143
143
  - - '='
144
144
  - !ruby/object:Gem::Version
145
- version: '1.38'
145
+ version: 1.92.0
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - '='
151
151
  - !ruby/object:Gem::Version
152
- version: '1.38'
152
+ version: 1.92.0
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: rubocop-performance
155
155
  requirement: !ruby/object:Gem::Requirement
@@ -235,6 +235,7 @@ files:
235
235
  - lib/fastlane/plugin/stream_actions/actions/build_app_for_ios_simulator.rb
236
236
  - lib/fastlane/plugin/stream_actions/actions/build_test_coverage_map.rb
237
237
  - lib/fastlane/plugin/stream_actions/actions/check_unsafe_flags.rb
238
+ - lib/fastlane/plugin/stream_actions/actions/clone_internal_metrics.rb
238
239
  - lib/fastlane/plugin/stream_actions/actions/core_version.rb
239
240
  - lib/fastlane/plugin/stream_actions/actions/current_branch.rb
240
241
  - lib/fastlane/plugin/stream_actions/actions/custom_match.rb
@@ -265,6 +266,7 @@ files:
265
266
  - lib/fastlane/plugin/stream_actions/actions/update_sdk_size_in_readme.rb
266
267
  - lib/fastlane/plugin/stream_actions/actions/update_testplan.rb
267
268
  - lib/fastlane/plugin/stream_actions/actions/wait_android_emu_idle.rb
269
+ - lib/fastlane/plugin/stream_actions/helper/metrics_helper.rb
268
270
  - lib/fastlane/plugin/stream_actions/helper/test_coverage_map_helper.rb
269
271
  - lib/fastlane/plugin/stream_actions/version.rb
270
272
  homepage: https://github.com/GetStream/fastlane-plugin-stream_actions