ci(release): respect gh api exit code when probing for existing release - #7
Merged
Merged
Conversation
`gh api` writes the 404 JSON body to stdout (not just stderr), so the
previous `existing=$(... 2>/dev/null || echo '')` pattern would set
`existing` to `{"message":"Not Found",...}` whenever the release didn't
exist yet. The script then took the "already exists" branch with
`release_id=null`, the build matrix received `releaseId: null` and
silently skipped uploads, and the finalize step blew up trying to PATCH
release id `null`.
Use `if existing=$(gh api ...); then` instead, which only enters the
"exists" branch when the API call actually returned 200.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
🔍 PR checksType: ⏭️ Merging will not trigger a release
Auto-generated by |
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.
Summary
Fix a silent failure in
release.ymldiscovered while cutting v0.1.2: the build matrix receivedreleaseId: nulland skipped all uploads, leaving an empty release behind.Root cause
gh apiwrites the 404 JSON body (not just an exit code) to stdout. The previous probe:set
existingto{"message":"Not Found",...}whenever the release didn't exist yet, took the wrong "already exists" branch, and propagatedrelease_id=nulldownstream.Fix
Now we only treat it as "exists" when the API actually returned 200.
Test plan
Prepare releasestep should printCreated release <id> for v0.1.2, builds upload, finalize promotes out of draft.🤖 Generated with Claude Code