Repository navigation
fix(release-pr): stop the changelog racing the API-pushed version bump - #265
Conversation
get-pr-commit-range re-read pr.head.sha from a live GET /pulls/{n} that raced
the ref update done by github/api/commit — which creates the `chore: bump
version` commit and moves refs/heads/<branch> through the REST API alone,
never fetching it into the job's local checkout. The range's head sha was
therefore absent locally, so `git log <base>..<head>` in "Compute commit types
in PR range" fataled (exit 128, failing the labels step) and
generate-comprehensive-changelog silently emitted an empty "successful"
changelog (reproduced on droidsock PR #19).
- get-pr-commit-range: use the local HEAD (the release branch's content tip and
the bump commit's parent; the bump commit is filtered from the changelog/label
steps regardless) as the range head, falling back to the API head only when
HEAD can't be read. Always locally resolvable — no propagation race.
- generate-comprehensive-changelog: fail loud when a base..head range has an
endpoint missing from the checkout instead of shipping an empty changelog.
- update-release-pr "Compute commit types": validate both range endpoints
resolve before `git log`, erroring clearly instead of a bare fatal/exit 128.
Fixes #262
There was a problem hiding this comment.
🟢 Approval recommended
The changes are targeted and reduce a concrete failure mode; the remaining feedback is limited to minor documentation/PR-metadata alignment.
Pull request overview
This PR hardens the release-PR automation against a race where a version-bump commit is pushed via the GitHub API (updating the remote ref) but is not present in the job’s local checkout, causing downstream git log <base>..<head> consumers to fail or generate an empty changelog.
Changes:
- Prefer the locally checked-out
HEADwhen computing the PR commit range, falling back to the API-reported head SHA only whenHEADcan’t be resolved. - Add explicit “fail loud” validation when a commit-range endpoint isn’t present locally (both in the changelog generator and in the commit-type labeling step).
- Improve error messaging so the failure mode is actionable when the range can’t be computed from the local repo state.
File summaries
| File | Description |
|---|---|
.github/actions/github/steps/get-pr-commit-range/action.mjs |
Switches commit-range head selection to prefer local HEAD to avoid missing API-pushed commits in local .git. |
.github/actions/github/jobs/update-release-pr/action.yml |
Adds a guard that errors out if the computed commit range can’t be resolved in the local checkout before computing commit types. |
.github/actions/git/steps/generate-comprehensive-changelog/action.mjs |
Adds a preflight check to avoid silently producing an empty changelog when the provided range can’t resolve locally. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Addressing Copilot review on #265: the comment said the API-head fallback is for 'an edge/detached checkout', but git rev-parse HEAD resolves fine in a detached HEAD. The fallback is really for when the workspace isn't a git checkout at all (or git is unavailable). Reword accordingly.
There was a problem hiding this comment.
🟢 Approval recommended
The changes consistently address the local-checkout vs API-pushed-SHA mismatch and add appropriate fail-fast safeguards without introducing conflicting behavior in the updated workflow path.
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 0 new
- Review effort level: Lite
🚀 What's Changed
💥 Breaking Changes
No breaking changes
✨ Features
No new features
🐛 Bug Fixes
No bug fixes
📦 Dependencies
No dependency updates
🔧 Other Changes
👥 Contributors