fastlane-plugin-stream_actions 0.4.23 → 0.4.25

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: 6bd49d93c5278338894b7f0a1f451c50604b8563a214cf130a35bdb004a55570
4
- data.tar.gz: e152e43d0b966453bd03b9d8427b031cbcb79e337017f7fe7270c5c88a35d975
3
+ metadata.gz: fb6977ab4caee9d93986f8bb8866d61e9a4102796e63bb6e52d8aba1daa033d9
4
+ data.tar.gz: 07b9ec5f014ff16120980469216ecdec0e168f1e5fb7f49cebd5d9e347cb72d9
5
5
  SHA512:
6
- metadata.gz: 971a3fb19005a51d3a7c6c238e5502d3c126ee3cd3a11149947ec88da572404f78fcbe3e6c5b37c7401b77b3cb187caf2260660735db5988fcb3aba4c4a75b26
7
- data.tar.gz: 5c21de0d3d091550d84f3e48ac48152cd93a01b991a70620c9102b53e165925c9433513ead4581c654072839164d58caf992635fab963a5acb1777efed8ed8b5
6
+ metadata.gz: 51e3b04b6aada1ce419e4c2f649b7f7e8ac40ebd8dcf12f3696d575f52894451d41f12e79b0351b5da988a342a08e5f51ce8dfff7a76de83ced631286da6b8f3
7
+ data.tar.gz: 2d5f345f892bd134c3090efba303d1d4a115800cb0478680c9118f009bf0e4f31a791589c82ce43b22b4fd3a2bd75b4b60fb8905be362002fda330c6e2fcb138
@@ -59,7 +59,12 @@ module Fastlane
59
59
  return false
60
60
  end
61
61
 
62
- next unless self.touches_sources?(self.commit_files(repo, sha), params[:sources])
62
+ files = self.commit_files(repo, sha)
63
+ if files.nil?
64
+ UI.important("Could not list the files of commit #{short}; running check")
65
+ return true
66
+ end
67
+ next unless self.touches_sources?(files, params[:sources])
63
68
 
64
69
  UI.important("Last sources commit #{short} was not verified by a passing run; running check")
65
70
  return true
@@ -71,21 +76,21 @@ module Fastlane
71
76
 
72
77
  # PR commits, newest first (gh returns them oldest first).
73
78
  def self.pr_commit_shas(pr_num)
74
- self.gh_path_lines(Actions.sh("gh pr view #{pr_num} --json commits -q '.commits[].oid'")).reverse
79
+ self.gh_path_lines(self.gh("gh pr view #{pr_num} --json commits -q '.commits[].oid'")).reverse
75
80
  rescue StandardError
76
81
  []
77
82
  end
78
83
 
79
- # Files changed by a single commit (relative to its first parent).
84
+ # Files changed by a single commit (relative to its first parent), or nil when they cannot be read.
80
85
  def self.commit_files(repo, sha)
81
- self.gh_path_lines(Actions.sh("gh api repos/#{repo}/commits/#{sha} --paginate -q '.files[].filename'"))
86
+ self.gh_path_lines(self.gh("gh api repos/#{repo}/commits/#{sha} --paginate -q '.files[].filename'"))
82
87
  rescue StandardError
83
- []
88
+ nil
84
89
  end
85
90
 
86
91
  # True only if every required check has its latest run concluded as 'success' on the commit.
87
92
  def self.required_checks_passed?(repo, sha, required_checks)
88
- out = Actions.sh(
93
+ out = self.gh(
89
94
  "gh api \"repos/#{repo}/commits/#{sha}/check-runs?per_page=100\" --paginate " \
90
95
  "-H \"Accept: application/vnd.github.v3+json\" " \
91
96
  "-q '.check_runs[] | \"\\(.name)\\t\\(.conclusion)\\t\\(.completed_at)\"'"
@@ -133,11 +138,11 @@ module Fastlane
133
138
  end
134
139
  end
135
140
 
136
- self.gh_path_lines(Actions.sh("gh pr view #{params[:github_pr_num]} --json files -q '.files[].path'"))
141
+ self.gh_path_lines(self.gh("gh pr view #{params[:github_pr_num]} --json files -q '.files[].path'"))
137
142
  end
138
143
 
139
144
  def self.compare_push_files(repo, before, after)
140
- self.gh_path_lines(Actions.sh(
145
+ self.gh_path_lines(self.gh(
141
146
  "gh api \"repos/#{repo}/compare/#{before}...#{after}\" " \
142
147
  "-H \"Accept: application/vnd.github.v3+json\" " \
143
148
  "-q '.files[].filename'"
@@ -146,6 +151,19 @@ module Fastlane
146
151
  nil
147
152
  end
148
153
 
154
+ # One run often asks about many `sources` for the same PR, so each gh command runs only once.
155
+ # Failed commands are not cached.
156
+ def self.gh(command)
157
+ @gh_cache ||= {}
158
+ return @gh_cache[command] if @gh_cache.key?(command)
159
+
160
+ @gh_cache[command] = Actions.sh(command)
161
+ end
162
+
163
+ def self.clear_cache
164
+ @gh_cache = {}
165
+ end
166
+
149
167
  def self.gh_path_lines(output)
150
168
  output.to_s.split("\n", -1).map(&:strip).reject(&:empty?)
151
169
  end
@@ -180,6 +198,9 @@ module Fastlane
180
198
  are proven and it returns false. The walk stops at the commit that changed `sources` (older
181
199
  commits carry different sources); if none of them passed, the sources are unverified -> true.
182
200
  If `sources` were never changed anywhere in the PR, there is nothing to test -> false.
201
+ If the commits or their files cannot be read, the sources are unknown -> true.
202
+
203
+ Each gh command runs once per fastlane run, so asking about many `sources` reuses the lookups.
183
204
 
184
205
  This is what prevents a docs-only follow-up commit (e.g. editing CHANGELOG.md) from skipping tests
185
206
  when the underlying source changes never passed CI.
@@ -17,14 +17,19 @@ module Fastlane
17
17
  body = 'This PR was created automatically by CI.'
18
18
  body += "\n\nTriggered by: #{run_url}" if run_url
19
19
 
20
- other_action.create_pull_request(
21
- api_token: ENV.fetch('GITHUB_TOKEN'),
20
+ # `api_bearer`, because GitHub App tokens do not authenticate with the Basic scheme of `api_token`.
21
+ pull_request = other_action.create_pull_request(
22
+ api_bearer: ENV.fetch('GITHUB_TOKEN'),
22
23
  repo: params[:github_repo],
23
24
  title: params[:title],
24
25
  head: params[:head_branch],
25
26
  base: params[:base_branch],
26
27
  body: body
27
28
  )
29
+ # `create_pull_request` only logs a failed request and returns nil.
30
+ unless pull_request
31
+ UI.user_error!("Failed to create the pull request. The branch #{params[:head_branch]} is already pushed.")
32
+ end
28
33
  end
29
34
  end
30
35
 
@@ -20,7 +20,8 @@ module Fastlane
20
20
  make_latest = params[:make_latest]
21
21
  release = other_action.set_github_release(
22
22
  repository_name: params[:github_repo],
23
- api_token: params[:github_token],
23
+ # `api_bearer`, because GitHub App tokens do not authenticate with the Basic scheme of `api_token`.
24
+ api_bearer: params[:github_token],
24
25
  name: version_number,
25
26
  tag_name: version_number,
26
27
  description: changes,
@@ -52,7 +53,7 @@ module Fastlane
52
53
  UI.user_error!('Failed to create the GitHub release') unless release.kind_of?(Hash) && release['id']
53
54
 
54
55
  other_action.github_api(
55
- api_token: params[:github_token],
56
+ api_bearer: params[:github_token],
56
57
  http_method: 'PATCH',
57
58
  path: "repos/#{params[:github_repo]}/releases/#{release['id']}",
58
59
  body: { draft: false, make_latest: 'false' }
@@ -45,14 +45,22 @@ module Fastlane
45
45
  commit_changes(version_number)
46
46
 
47
47
  if params[:create_pull_request]
48
- other_action.create_pull_request(
49
- api_token: params[:github_token],
48
+ # `api_bearer`, because GitHub App tokens do not authenticate with the Basic scheme of `api_token`.
49
+ pull_request = other_action.create_pull_request(
50
+ api_bearer: params[:github_token],
50
51
  repo: params[:github_repo],
51
52
  title: "#{version_number} Release",
52
53
  head: "release/#{version_number}",
53
54
  base: 'main',
54
55
  body: changes.to_s
55
56
  )
57
+ # `create_pull_request` only logs a failed request and returns nil.
58
+ unless pull_request
59
+ UI.user_error!(
60
+ "Failed to create the release pull request. The branch release/#{version_number} is already pushed: " \
61
+ 'open the pull request by hand, or delete the branch before you start the release again.'
62
+ )
63
+ end
56
64
  end
57
65
 
58
66
  UI.success("Successfully started release #{version_number}! 🚢")
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module StreamActions
3
- VERSION = '0.4.23'
3
+ VERSION = '0.4.25'
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.23
4
+ version: 0.4.25
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-16 00:00:00.000000000 Z
11
+ date: 2026-11-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: xctest_list