fix(publish): run communique after release is published#512
Conversation
|
Note Gemini is unable to generate a summary for this pull request due to the file types involved not being currently supported. |
communique uses GET /releases/tags/{tag} to find the release, which only
returns published releases. Running it after gh release edit --draft=false
guarantees the release is visible.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
b36dfce to
6a7c6ef
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #512 +/- ##
=======================================
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:
|
|
Superseded by #513, which goes further by extracting communique into its own dedicated job. |
There was a problem hiding this comment.
Pull request overview
This PR fixes a race condition in the release publishing workflow where communique was being called before the GitHub release was published, causing the GitHub API call to fail. The fix moves the communique step to after the release is published and adds retry logic for tag indexing delays.
Changes:
- Moved communique release notes enhancement to run after
gh release edit --draft=falseinstead of immediately after draft creation - Added retry loop (up to 30 attempts) when creating draft releases to handle GitHub's tag indexing delay
- Added validation to ensure created releases have the correct tag name before proceeding
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| - name: Create draft release | ||
| if: ${{ startsWith(github.ref, 'refs/tags/v') }} | ||
| run: | | ||
| TAG_NAME="${{ github.ref_name }}" |
There was a problem hiding this comment.
The inline comment explaining this awk command was removed. Consider adding a brief comment explaining that this extracts the first version section from CHANGELOG.md, as complex awk one-liners can be difficult to understand at a glance.
| TAG_NAME="${{ github.ref_name }}" | |
| # Extract the first version section from CHANGELOG.md for the release notes |
| BODY=$(cat /tmp/release-notes.txt) | ||
| # GitHub may not have indexed the tag yet after a push. Draft releases | ||
| # created before indexing get "untagged-*" placeholder tag names. | ||
| for attempt in $(seq 1 30); do |
There was a problem hiding this comment.
The hardcoded values 30 attempts and 5 seconds sleep time (totaling 150 seconds maximum wait) lack explanation. Consider adding a comment explaining the rationale for these specific timeout values, or extracting them as named variables for better maintainability.
Summary
communique generate --github-releasecallsGET /releases/tags/{tag}to find the release to updateGET /releases?per_page=10(which does include drafts), it ran within ~700ms of the draft being created — before GitHub's list API reflected itgh release edit --draft=falseguarantees the release is visible and eliminates the race entirelyAlso fixes the related communique bug in
~/src/communique:Err(_) => Ok(None)was silently swallowing list-endpoint errors, making the draft fallback fail invisibly.Test plan
🤖 Generated with Claude Code
Note
Low Risk
Low risk workflow-only change that reorders when release notes are generated; main risk is altering release automation timing/behavior if the post-publish step fails (it is
continue-on-error).Overview
Moves the
communique generate --github-releasestep out of the draft-release creation job and into thereleasejob aftergh release edit --draft=false(and only for non-workflow_dispatchruns).This ensures release-note enhancement runs against a published release, avoiding race conditions where GitHub’s tag/release lookup APIs can’t find newly created drafts yet.
Written by Cursor Bugbot for commit 6a7c6ef. This will update automatically on new commits. Configure here.