Skip to content

ci: rebase the badge and figure pushes onto a main that moved - #104

Merged
timzifer merged 1 commit into
mainfrom
ci/main-push-race
Nov 20, 2026
Merged

timzifer merged 1 commit into
mainfrom
ci/main-push-race

Conversation

@timzifer

Copy link
Copy Markdown
Owner

Fixes #102.

  • New .github/scripts/push-to-main.sh MESSAGE PATH...: stage (new files count), commit, fetch origin main, guard that main still contains $GITHUB_SHA, rebase origin/main, push — retried 5× with backoff. Both commit steps use it.
  • concurrency per job only for pushes to main (main-push-coverage, main-push-figures, cancel-in-progress: false), so two runs of one job never push at once and an older render cannot overwrite a newer one. PR runs get a per-run group: a shared group would cancel pending PR runs, and Documentation figures is a required check.
  • A pending main run superseded by a newer merge may be cancelled by the group — intended: the newer run writes the newer badge/figures.

Simulated locally (bare origin, --depth 1 clone like actions/checkout, main advanced mid-run): rebases and pushes; a run with no change exits cleanly. The real proof is the first quick pair of merges after this lands.

https://claude.ai/code/session_015BfhXWEPyCFY4fZhg5nzsh

The coverage and figures jobs commit generated files on top of the
commit they measured and push to main. A merge that lands while they
run moves main, and the push was refused with "fetch first" — five
times on 2026-11-19 alone, during a run of merges.

Both commit steps now go through .github/scripts/push-to-main.sh: it
stages the paths (a new figure counts as a change), commits, fetches
main, rebases onto it and pushes, retrying a few times, and declines to
push if main no longer contains the measured commit. The files are
written by nothing else, so the rebase cannot conflict with a person's
commit. Each job also gets a concurrency group on main, so two runs of
one job never push at once and an older render cannot land after a
newer one; a pull request gets a group per run, because a shared group
would cancel its pending runs and the figures check is required.

Simulated against a local bare repository with a depth-1 clone, the
way actions/checkout leaves it: the commit rebases onto the moved main
and pushes.

Fixes #102

Claude-Session: https://claude.ai/code/session_015BfhXWEPyCFY4fZhg5nzsh
@timzifer
timzifer merged commit eccf6a9 into main Nov 20, 2026
18 checks passed
@timzifer
timzifer deleted the ci/main-push-race branch November 20, 2026 06:58
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.

ci: the coverage and figures pushes are rejected when main has moved

1 participant