From 74fe172d3107d09068a21d77526e6b4cc1a0481b Mon Sep 17 00:00:00 2001 From: Matt Fisher Date: Wed, 7 Oct 2026 18:21:28 +1100 Subject: [PATCH 1/2] fix(update): lease the push against the fetched branch 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 --- .github/workflows/template-update.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/template-update.yml b/.github/workflows/template-update.yml index 45809fb..4ae5798 100644 --- a/.github/workflows/template-update.yml +++ b/.github/workflows/template-update.yml @@ -150,7 +150,14 @@ jobs: git checkout -b "$BRANCH" git add -A git commit -m "chore: apply template updates from $REF" - git push --force-with-lease \ + # The push goes to a URL rather than to `origin`, so a bare + # --force-with-lease has no remote-tracking ref to compare against + # and refuses with "stale info" whenever the branch already exists, + # which is every week after a run that pushed but couldn't open its + # PR. Lease against what checkout fetched instead; empty means the + # branch must not exist yet. + expect=$(git rev-parse -q --verify "refs/remotes/origin/$BRANCH" || true) + git push --force-with-lease="$BRANCH:$expect" \ "https://x-access-token:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" "$BRANCH" BODY="Applied by \`copier update --vcs-ref $REF\`." From f9c784dc90a556b79c9cbc3a53f96a6bd7991f95 Mon Sep 17 00:00:00 2001 From: Matt Fisher Date: Wed, 7 Oct 2026 18:21:28 +1100 Subject: [PATCH 2/2] chore(changelog): note the template-update push fix Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d6f6f7b..762b5ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,16 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), ## [Unreleased] +### Fixed + +- `template-update.yml` no longer fails every run once its update branch + exists. It pushed with a bare `--force-with-lease` to a URL, which gives git + no remote-tracking ref to lease against, so the push was refused with + `stale info` whenever the branch was already there. A run that pushed but + couldn't open its PR left every later run failing. The push now leases + against the branch as checkout fetched it, so it still refuses to overwrite + a commit pushed during the run. + ## [1.1.0] - 2026-09-22 ### Added