Fix GitHub release asset lookup on upload_github_release_assets#753
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves the robustness of GitHub Release discovery used by upload_github_release_assets by adding a fallback path when the paginated releases list doesn’t include an existing published release.
Changes:
- Refactors release lookup into a helper that first scans
client.releases(repo)(to preserve draft-release behavior) and then falls back toclient.release_for_tag(repo, tag)when needed. - Adds/adjusts RSpec coverage to verify (1) no fallback call when the releases list contains the target release and (2) fallback behavior when the releases list is empty.
- Adds a Trunk changelog entry documenting the bug fix.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| lib/fastlane/plugin/wpmreleasetoolkit/helper/github_helper.rb | Adds a draft-first release lookup with a published-release-by-tag fallback, used by get_release (and therefore upload_release_assets). |
| spec/github_helper_spec.rb | Adds tests covering the “don’t call release_for_tag when list hit” and “fallback to release_for_tag when list miss” behaviors. |
| CHANGELOG.md | Documents the improved release lookup behavior under ## Trunk → Bug Fixes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
69fd085 to
362a6c0
Compare
mokagio
reviewed
Jul 10, 2026
Comment on lines
+254
to
+258
| def release_for_tag(repository:, version:) | ||
| client.release_for_tag(repository, version) | ||
| rescue Octokit::NotFound | ||
| nil | ||
| end |
Contributor
There was a problem hiding this comment.
What about other errors that might get thrown? Are we okay to crash on them? Not sure how strong of a concern it is, but seeing a single rescue made me wonder...
mokagio
reviewed
Jul 10, 2026
mokagio
approved these changes
Jul 10, 2026
Co-authored-by: Gio Lodi <gio@mokacoding.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does it do?
Fixes
upload_github_release_assetsrelease lookup when the releases list misses an existing published release.The helper still checks
client.releases(repository)first so draft releases continue to work. If that list does not include the requested tag, it falls back to GitHub's direct release-by-tag endpoint once. A missing release still fails with the existing clear error.Checklist before requesting a review
bundle exec rubocopto test for code style violations and recommendations.specs/*_spec.rb) if applicable.bundle exec rspecto run the whole test suite and ensure all your tests pass.CHANGELOG.mdfile to describe your changes under the appropriate existing###subsection of the existing## Trunksection.MIGRATION.mdfile to describe how the changes will affect the migration from the previous major version and what the clients will need to change and consider.