Skip to content

ci: scope the concurrency group by event so a push run is never cancelled by its PR run - #623

Merged
phamtruonghung merged 1 commit into
mainfrom
ci/concurrency-per-event
Nov 26, 2026
Merged

phamtruonghung merged 1 commit into
mainfrom
ci/concurrency-per-event

Conversation

@phamtruonghung

@phamtruonghung phamtruonghung commented Nov 26, 2026 •

Copy link
Copy Markdown
Owner

Why

Since #620 (0c483f7) the CI concurrency group was ci-${{ github.head_ref || github.ref_name }}, shared by a branch's push run and the pull_request run it leads to. The PR run cancelled the push run, the cancelled run stayed on the same head SHA with the same four job names, and the ruleset main: required checks before merge counted those cancelled contexts. PR #621 (head 075e950) sat BLOCKED with all four checks green until the cancelled push run 45826920718 was deleted by hand.

What

.github/workflows/ci.yml only:

group: ci-${{ github.event_name }}-${{ github.head_ref || github.ref_name }}

cancel-in-progress (never on main) and the paths-ignore from #620 are unchanged; the push trigger stays. Cancellation now happens only within one event, where a cancel always means a newer SHA on the same ref (a newer push, or a newer PR head) — so a cancelled run can never be the only result on a PR's head. That supersession is the dedupe that remains.

Cost, measured on this repo's runs

For a branch that pushes once and then opens a PR, the number of runs created is 2 either way:

So the extra cost against #620 is the rest of the push run that used to be cancelled: on this PR the push run 45832310327 took 858 job-seconds (frontend 688 s, backend 128 s, images 17 s + 25 s) ≈ 14 runner-minutes, once per branch that is pushed before its PR opens. The dedupe that remains is supersession within one event: repeated pushes to a branch, or repeated heads of a PR, still collapse to the newest run.

Evidence

  1. Pushed, then PR'd: gh pr view 623 --json mergeStateStatus,statusCheckRollup → CLEAN, 8/8 contexts SUCCESS (four names × push + pull_request), no run deleted.
  2. Two quick pushes to probe branch probe/ci-event-scoped (8 s apart): push run 45832504099 @c547c683 cancelled, push run 45832531336 @81e0c8bc in_progress (cancelled by hand afterwards to save minutes; branch deleted). This PR's head was unaffected.
  3. A markdown-only commit pushed to the same probe branch (@e4e60071) started no run.

…lled by its PR run

The group was keyed on the source branch alone, so the pull_request run
cancelled the push run on the same head SHA. The cancelled run kept the
same four job names, and the ruleset's required checks counted those
cancelled contexts: PR #621 stayed BLOCKED with all four checks green
until the cancelled push run was deleted by hand. Keying the group on
the event as well means cancellation only happens within one event,
where it always means a newer SHA on the same ref.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@phamtruonghung
phamtruonghung merged commit 88602db into main Nov 26, 2026
8 checks passed
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