fix(release): find an existing draft by listing, upload to it by id - #535
Merged
Merged
Conversation
GitHub's releases/tags/<tag> endpoint never returns drafts, so re-pointing an unpublished tag took the "no release yet" path and created a second 2.3.0 draft instead of updating the first. The workflow now lists releases to find the tag's release, fails if more than one exists, and updates a draft's notes and assets by release id; `gh release upload <tag>` misses drafts the same way, so assets are replaced through the uploads API. Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
|
- Pass the tag (and asset names) to jq with --arg instead of splicing them into the filter text. - Serialize runs per tag, queued rather than cancelled, so two pushes of the same tag can't both find no release and each create a draft. - Paginate the asset lookup. - Restate tag_name when PATCHing the draft's notes: a PATCH without it renames a draft's tag to untagged-<hash> (verified against a draft on an existing tag), which would detach the draft from its tag and send the next run down the create path. Likely also how 2.1.1 was published as untagged-<hash>. Co-Authored-By: Claude <noreply@anthropic.com>
…build uploads - set -o pipefail in the create/update step (run steps default to bash -e without it), so a failed release listing fails the step instead of reading as "no release" and creating a duplicate draft. - Before touching the release, check that the tag still points at the commit this run built; if it was re-pointed since, exit without uploading. GitHub keeps only the newest pending run per concurrency group and doesn't promise push order, so this, not the queue, is what keeps an older build off the draft. Co-Authored-By: Claude <noreply@anthropic.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
Re-pointing the unpublished
2.3.0tag created a second draft instead of updating the first. GitHub'sreleases/tags/<tag>endpoint never returns drafts, so the workflow's lookup 404'd and took the "no release yet" path. The mid-upload "was it just published?" re-check used the same endpoint, so it would also have failed on a draft.--paginate, with the tag passed to jq via--arg):PATCH releases/<id>, restatingtag_name. A PATCH without it renames a draft's tag tountagged-<hash>, verified against a draft on an existing tag, which detaches the draft from its tag. That is probably also how 2.1.1 was published asuntagged-<hash>.gh release upload <tag>also failed to find a draft in testing, so it's no longer used.concurrencygroup (queued, not cancelled), so two pushes of the same tag can't both create a draft.How I tested it
2.3.0-beta.1, whose release had been deleted):2.3.0-beta.1.main.jswere the last run's, and exactly one release existed for the tag.2.3.0draft, whichreleases/tags/2.3.0404s on.AI assistance: Claude Code found this during the 2.3.0 release, when a re-pointed tag created a duplicate draft, and wrote the fix at Leo's request. The
tag_namerename was found while testing the fix. Leo still needs to review the workflow change.Checklist
bun run check,bun run format,bun run lint, andbun run testpass locally (no source changes; workflow YAML validated)manifest.json: n/a