Skip to content

armgit / bento

Public Imported from GitHub
0

Bento, the office suite that fits in a file

CI: give every merge commit on main its own run

nyblnetfcbe13cb087d
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 5cf35f73..b379da1b 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -17,11 +17,21 @@ on:
branches: [main]
concurrency:
- group: ci-${{ github.workflow }}-${{ github.ref }}
- # Cancel superseded runs on PR branches — only the tip matters there. NOT on
- # main: every merge commit is a distinct state, and the post-merge run is the
- # safety net for interaction bugs between PRs merged close together. Four
- # merges in a few minutes once left two merge commits only partly verified.
+ # PR branches share one group per ref, so a new push collapses onto the tip —
+ # only the tip matters there. Pushes to main get a group PER COMMIT, because
+ # every merge commit is a distinct state and the post-merge run is the safety
+ # net for interaction bugs between PRs merged close together.
+ #
+ # Per-commit, NOT merely cancel-in-progress:false — that setting alone does
+ # not queue every run. GitHub keeps at most ONE pending run per group, so a
+ # third push cancels the PENDING one instead of lining up behind it; it
+ # protects the run in progress, not the queue. Merging 19 PRs in a row that
+ # way cancelled 17 runs on main and left those merge commits unbuilt, and the
+ # "four merges in a few minutes" incident this setting was meant to fix was
+ # the same failure. A unique group per commit is what actually guarantees it.
+ group: ci-${{ github.workflow }}-${{ github.ref }}${{ github.ref == 'refs/heads/main' && format('-{0}', github.sha) || '' }}
+ # Moot on main now — each commit is alone in its group — but kept truthful:
+ # superseded PR-branch runs still collapse.
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs: