Skip to content

Lease the template-update push against the fetched branch - #12

Merged
MattFisher merged 1 commit into
mainfrom
fix/template-update-push
Oct 7, 2026
Merged

MattFisher merged 1 commit into
mainfrom
fix/template-update-push

Conversation

@MattFisher

Copy link
Copy Markdown

template-update.yml fails every week once its update branch exists. It pushes with a bare --force-with-lease to a URL rather than to origin, so git has no remote-tracking ref to lease against and refuses the push with stale info.

This is live in the Cloudflare Worker template, which has the same step. Its two consumers, llm-prices and logfile-upload, each had one run that pushed chore/template-update but couldn't open the PR (the Actions pull-request setting was off). Every run since has failed at the push. For example, llm-prices run 37323803351:

! [rejected]        chore/template-update -> chore/template-update (stale info)

The fix leases against refs/remotes/origin/$BRANCH, which checkout's full fetch already populates. An empty value means the branch must not exist yet.

Testing

I reproduced it against a local bare remote, with the remote-tracking refs fetched the way checkout fetches them:

  • Branch exists: the old command is rejected with stale info. The new one force-pushes.
  • Branch absent: the new one creates it.
  • Someone pushes to the branch after checkout: the new one is still refused. The lease still protects against that race.

actionlint and zizmor --offline --persona=auditor are clean on the file.

The matching Cloudflare template fix is a separate PR there.

🤖 Generated with Claude Code

A bare --force-with-lease to a URL has no remote-tracking ref to compare
against, so the push is refused with "stale info" whenever the update
branch already exists. Lease against the ref checkout fetched instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MattFisher
MattFisher merged commit 7f6a0ed into main Oct 7, 2026
3 checks passed
@MattFisher
MattFisher deleted the fix/template-update-push branch October 7, 2026 07:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant