fix(publish): anchor gh release create to GITHUB_SHA to avoid untagged release#506
Conversation
…d release Without --target, gh release create resolves the tag via the GitHub API which can race with tag propagation and create an untagged-* draft release that taiki-e/upload-rust-binary-action cannot find by tag name. Explicitly passing --target "$GITHUB_SHA" bypasses the tag lookup and anchors the release to the exact commit SHA from the triggering event. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Note Gemini is unable to generate a summary for this pull request due to the file types involved not being currently supported. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #506 +/- ##
=======================================
Coverage 77.88% 77.88%
=======================================
Files 48 48
Lines 6660 6660
Branches 6660 6660
=======================================
Hits 5187 5187
Misses 1109 1109
Partials 364 364 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR updates the release-publishing GitHub Actions workflow to prevent gh release create from creating untagged-* draft releases when a tag push hasn’t been indexed by GitHub’s Releases API yet, by anchoring the release creation to the workflow’s commit SHA.
Changes:
- Add
--target "$GITHUB_SHA"togh release createto bind the release to the triggering commit SHA. - Keep the release tag name (
v*) unchanged while avoiding the tag-lookup race condition.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
### 🐛 Bug Fixes - **(publish)** anchor gh release create to GITHUB_SHA to avoid untagged release by [@jdx](https://github.com/jdx) in [#506](#506)
…_name (#508) ## Summary - Previous fix (#506) added `--target "$GITHUB_SHA"` to `gh release create`, but the releases are still created as `untagged-*` - Root cause (revised): something creates a GitHub release for the tag ~60 seconds before the `publish-cli` workflow starts (timestamps: v2.17.1 release at 12:36:44, workflow start at 12:37:44; v2.17.2 release at 13:07:56, workflow start at 13:08:47). When `gh release create "v2.17.x"` finds an existing release for that tag, it silently creates a new `untagged-*` draft as a fallback instead of failing - Fix: call `gh api repos/${{ github.repository }}/releases --method POST` directly with explicit `-f tag_name=` and `-f target_commitish=` fields. This bypasses the `gh release create` wrapper entirely and guarantees the `tag_name` is set correctly regardless of pre-existing releases ## Test plan - [ ] Verify next release creates a draft with `tag_name: v2.x.x` (not `untagged-*`) via `gh api repos/jdx/usage/releases --jq '.[0]'` - [ ] Confirm `taiki-e/upload-rust-binary-action` finds the release and uploads binaries successfully 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Small, workflow-only change affecting how GitHub releases are created; primary risk is misconfigured API parameters causing draft release creation to fail. > > **Overview** > Fixes the `publish-cli` workflow’s draft release creation to avoid accidental `untagged-*` releases when a release already exists for a just-pushed tag. > > Replaces `gh release create` with a direct `gh api POST /repos/{owner}/{repo}/releases`, explicitly setting `tag_name`, `target_commitish`, and the changelog-derived release body before continuing with the existing release-notes enhancement and publish steps. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 8ecbb58. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary
gh release create --draft "v2.17.1"created a release with taguntagged-d8ea426c8964292e5b9ainstead ofv2.17.1taiki-e/upload-rust-binary-actioncould not find the release by tag name, failing allbuild-and-publishmatrix jobscommunique-based workflow callsgh release createalmost immediately after checkout, whereas the old workflow had a ~60snpm install -g @anthropic-ai/claude-codestep first. Without that delay,ghhits a race condition where GitHub's Releases API hasn't indexed the newly-pushed tag yet, so it falls back to creating anuntagged-*draftFix
Add
--target "$GITHUB_SHA"togh release create. This anchors the release to the exact commit SHA from the workflow trigger, bypassing the GitHub Releases API's tag lookup entirely. The release is still associated with the tag namev2.17.1but doesn't depend on the API having indexed the tag yet.Test plan
untagged-*)taiki-e/upload-rust-binary-actioncan find the release and upload binaries🤖 Generated with Claude Code
Note
Low Risk
Small CI workflow change limited to release creation behavior; low risk aside from potentially changing which commit a tag’s release points to if the tag is mis-pushed.
Overview
Ensures the
publish-cliworkflow always creates draft GitHub releases for the exact commit that triggered the run by adding--target "$GITHUB_SHA"togh release create.This avoids occasional
untagged-*draft releases (and downstream publish failures) when the tag hasn’t propagated/indexed yet at release-creation time.Written by Cursor Bugbot for commit 571ac7e. This will update automatically on new commits. Configure here.