Skip to content

Fix GitHub release asset lookup on upload_github_release_assets#753

Merged
iangmaia merged 3 commits into
trunkfrom
iangmaia/fix-github-release-asset-lookup
Jul 13, 2026
Merged

Fix GitHub release asset lookup on upload_github_release_assets#753
iangmaia merged 3 commits into
trunkfrom
iangmaia/fix-github-release-asset-lookup

Conversation

@iangmaia

@iangmaia iangmaia commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

What does it do?

Fixes upload_github_release_assets release 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

  • Run bundle exec rubocop to test for code style violations and recommendations.
  • Add Unit Tests (aka specs/*_spec.rb) if applicable.
  • Run bundle exec rspec to run the whole test suite and ensure all your tests pass.
  • Make sure you added an entry in the CHANGELOG.md file to describe your changes under the appropriate existing ### subsection of the existing ## Trunk section.
  • If applicable, add an entry in the MIGRATION.md file to describe how the changes will affect the migration from the previous major version and what the clients will need to change and consider.

Copilot AI review requested due to automatic review settings July 8, 2026 14:35
@iangmaia iangmaia requested a review from a team as a code owner July 8, 2026 14:35
@iangmaia iangmaia self-assigned this Jul 8, 2026
@iangmaia iangmaia changed the title Fix GitHub release asset lookup Fix GitHub release asset lookup on upload_github_release_assets Jul 8, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 to client.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.

@iangmaia iangmaia force-pushed the iangmaia/fix-github-release-asset-lookup branch from 69fd085 to 362a6c0 Compare July 8, 2026 14:40
@iangmaia iangmaia added the bug Something isn't working label Jul 8, 2026
Comment on lines +254 to +258
def release_for_tag(repository:, version:)
client.release_for_tag(repository, version)
rescue Octokit::NotFound
nil
end

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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...

@iangmaia iangmaia Jul 13, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Followed up in #755

Comment thread spec/github_helper_spec.rb Outdated
Co-authored-by: Gio Lodi <gio@mokacoding.com>
@iangmaia iangmaia merged commit 3171df5 into trunk Jul 13, 2026
6 checks passed
@iangmaia iangmaia deleted the iangmaia/fix-github-release-asset-lookup branch July 13, 2026 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants