fastlane-plugin-stream_actions 0.4.19 → 0.4.21

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: cdaded0af171b644219f1ff21fbbc95ce49989a3ab0a1b4cd4ef005d2fb0bac4
4
- data.tar.gz: 9a3fd47138ebe2038bee47ffd1d032ebca6eb90da13c0884196d19e6e6cbdfdf
3
+ metadata.gz: 48ca81e9bd133417043b2f7e747759ab7af1a284488b6a37869c87f5387e2be2
4
+ data.tar.gz: 7656e626ea44d19f7e9a3d03dcc40d3d1cf2d77ec821874d62dff38e121f7cdb
5
5
  SHA512:
6
- metadata.gz: 64bc765ced3b14f16c7c869116e43fcba25d2df49e028bdf323fe960ea6eefc7623bab5ae90422bb3d7304c52f82ccd87c78da5689aa7c7b00a0e311c442fc82
7
- data.tar.gz: 6e6a18692206c35cc09f015ba51ac843af3538c2620127cdb04908a767a4f8f4e252536d28188537f8b2ff48c07c5d97d68541f43dac850ee94936ef27fb09f8
6
+ metadata.gz: f8e3d2f4a84a4ee8e31b3605280818e1027b593d8550c54855e8fe73c941ddefdda081ed86d4c2836571ca5c9ff0ce3361cddf20b9b5e8d5fe4e36cb755a794b
7
+ data.tar.gz: 69e2b1a6996cc65b77574a7221aebf8790a2be31097c69c55b3004c4021049da4c7604e1a151704126a2d43eb41283712324e68c643c7f628fa61358b34e2dd6
@@ -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
@@ -6,9 +6,7 @@ module Fastlane
6
6
 
7
7
  release_branch =
8
8
  if other_action.is_ci
9
- # This API operation needs the "admin:org" scope.
10
- ios_team = `gh api orgs/GetStream/teams/#{params[:github_team_name]}/members -q '.[].login'`.split("\n")
11
- UI.user_error!("#{params[:author]} is not a member of the iOS Team") unless ios_team.include?(params[:author])
9
+ ensure_author_is_repo_admin(author: params[:author], github_repo: params[:github_repo])
12
10
 
13
11
  other_action.current_branch
14
12
  else
@@ -34,6 +32,20 @@ module Fastlane
34
32
  other_action.pr_comment(text: comment)
35
33
  end
36
34
 
35
+ # Admin access to the repo is what separates the iOS team from the rest of the org (which only has write).
36
+ # Unlike listing org team members, this endpoint works with the workflow's built-in GITHUB_TOKEN.
37
+ def self.ensure_author_is_repo_admin(author:, github_repo:)
38
+ UI.user_error!('Release author is not set') if author.to_s.empty?
39
+ UI.user_error!('GitHub repo is not set') if github_repo.to_s.empty?
40
+
41
+ permission = sh(
42
+ 'gh', 'api', "repos/#{github_repo}/collaborators/#{author}/permission", '--jq', '.permission',
43
+ print_command_output: false,
44
+ error_callback: ->(_) {}
45
+ ).to_s.strip
46
+ UI.user_error!("#{author} needs admin access to #{github_repo} to merge a release (has: #{permission})") unless permission == 'admin'
47
+ end
48
+
37
49
  #####################################################
38
50
  # @!group Documentation
39
51
  #####################################################
@@ -51,9 +63,10 @@ module Fastlane
51
63
  optional: true
52
64
  ),
53
65
  FastlaneCore::ConfigItem.new(
54
- key: :github_team_name,
55
- description: 'Github team name',
56
- default_value: 'ios-developers'
66
+ env_name: 'GITHUB_REPOSITORY',
67
+ key: :github_repo,
68
+ description: 'GitHub repo name (owner/name)',
69
+ optional: true
57
70
  )
58
71
  ]
59
72
  end
@@ -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"
@@ -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))
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module StreamActions
3
- VERSION = '0.4.19'
3
+ VERSION = '0.4.21'
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.19
4
+ version: 0.4.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - GetStream
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-10-29 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
@@ -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