fix: force-with-lease the bump branch so a stale one cannot fail the push - #96
Merged
andychoquette merged 1 commit intoSep 23, 2026
Conversation
…push The PushPR step did a plain `git push` of bump/$NEXT_SEMVER. That branch is recreated from $BASE_REF on every run, so when one already exists remotely for the same version it has diverged and the push is rejected non-fast-forward, failing the whole bump. This happens whenever a release PR is closed unmerged and the bump is re-run after $BASE_REF has moved on, which is not rare: deadline-cloud-for-cinema-4d had a bump/0.12.3 left over from a closed PR #560 and every subsequent Bump run failed until the branch was deleted by hand. Nine other stale bump/* branches are sitting in that repo, each one a latent repeat. Force is safe here because the branch only ever holds the release commit this run generated. --force-with-lease rather than --force keeps the protection against a genuinely concurrent push, and Checkout's fetch-depth: 0 guarantees the remote-tracking ref the lease compares against. Deleting the remote branch before pushing was the alternative, but that would close any open release PR for it. Also guard `gh pr create`: a closed PR for the head does not block a new one, but an open one does, and the force-push has already updated it. Signed-off-by: andychoquette <78888816+andychoquette@users.noreply.github.com>
crowecawcaw
approved these changes
Sep 23, 2026
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
PushPRinreusable_bump.ymldid a plaingit pushofbump/$NEXT_SEMVER. Switch it to--force-with-lease, and only callgh pr createwhen there is no open PR for that head.Why
bump/$NEXT_SEMVERis recreated from$BASE_REFon every run. If a branch for the same version already exists remotely, the two have diverged and the push is rejected non-fast-forward, failing the whole bump.This is not rare — it happens whenever a release PR is closed unmerged and the bump is re-run after
$BASE_REFhas moved on.deadline-cloud-for-cinema-4dhad abump/0.12.3left over from closed PR #560, and every subsequent Bump run failed until the branch was deleted by hand (failing run):Nine other stale
bump/*branches are still sitting in that repo (0.5.2,0.5.4,0.7.5,0.7.9,0.8.0,0.8.2,0.8.4,0.11.0,0.11.1), each a latent repeat of the same failure. Since this workflow is shared, every caller has the same exposure.Why force is safe, and why not the alternatives
The bump branch only ever holds the release commit generated by that run, so there is nothing on it to lose.
--force-with-leaseover--force: keeps the protection against a genuinely concurrent push. Checkout'sfetch-depth: 0guarantees the remote-tracking ref the lease compares against.git push origin --deletefirst: deleting the remote branch would close any open release PR for it.Notes
No new permission scopes, so callers need no change —
contents: writeis already granted by every caller of this workflow.Untested in CI: this only executes during a real release bump. Validated locally that the workflow still parses as YAML and that the step body passes
bash -n.