Skip to content

Commit 231836b

Browse files
authored
Clarify release lookup error handling (#755)
2 parents 3171df5 + ca54c74 commit 231836b

3 files changed

Lines changed: 17 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ _None_
2121

2222
### Internal Changes
2323

24+
- Added regression coverage for `upload_github_release_assets` direct release lookup errors. [#755]
2425
- Centralized `.strings` duplicate-key detection behind `StringsFileValidationHelper.scan_for_duplicate_keys`, returning a `[:scanned | :unsupported_format | :unscannable, payload]` tri-state that callers can map to their own warn-and-skip vs fail-closed policy. [#741]
2526
- `L10nHelper.strings_file_type` and `StringsFileValidationHelper.scan_for_duplicate_keys` accept `assume_valid:` to skip a redundant `plutil -lint` when the caller has already parsed the file. [#741]
2627

lib/fastlane/plugin/wpmreleasetoolkit/helper/github_helper.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,8 @@ def find_release(repository:, version:)
254254
def release_for_tag(repository:, version:)
255255
client.release_for_tag(repository, version)
256256
rescue Octokit::NotFound
257+
# A 404 only means the fallback did not find a release for this tag.
258+
# Other API errors should be surfaced.
257259
nil
258260
end
259261

spec/github_helper_spec.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -745,6 +745,20 @@ def create_release(is_draft:, assets: [], name: nil)
745745
end
746746
end
747747

748+
it 'does not hide unexpected direct release lookup errors' do
749+
allow(client).to receive(:releases).with(test_repo).and_return([])
750+
allow(client).to receive(:release_for_tag).with(test_repo, test_version).and_raise(Octokit::TooManyRequests)
751+
752+
with_tmp_file(named: 'test-app.zip') do |file_path|
753+
expect(client).not_to receive(:release_assets)
754+
expect(client).not_to receive(:upload_asset)
755+
756+
expect do
757+
upload_release_assets(assets: [file_path])
758+
end.to raise_error(Octokit::TooManyRequests)
759+
end
760+
end
761+
748762
it 'uploads one asset to the existing release' do
749763
with_tmp_file(named: 'test-app.zip') do |file_path|
750764
expect(client).to receive(:upload_asset).with(release_url, file_path, { content_type: 'application/octet-stream' })

0 commit comments

Comments
 (0)