Skip to content

fix(ci): stop same-commit events from cancelling runs - #696

Merged
sini merged 2 commits into
mainfrom
ci/no-rerun-on-review-request
Sep 24, 2026
Merged

sini merged 2 commits into
mainfrom
ci/no-rerun-on-review-request

Conversation

@sini

@sini sini commented Sep 24, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

CI on PRs shows false reds when a run is cancelled by another run for the same commit. If the cancel lands before a job's matrix expands, GitHub records the job under its literal name (Tests ${{ matrix.os }}, Check template ${{ matrix.template }} ${{ matrix.os }}) as failed. No later run reports under those names, so the red check stays on the commit even after a green re-run. #695 shows two such checks right now.

Two changes, in test, docs and bogus:

  1. Cancel in-progress runs only for new code. cancel-in-progress is now true only for synchronize (a new commit on the PR), or a push in workflows that already cancelled on push. Same-commit events (labeled, approving reviews, opened racing a review request) queue behind the running build instead of killing it. If a third event arrives, GitHub cancels the older queued run, which never started and so leaves no checks. main builds are still never cancelled.
  2. Drop review_requested from the triggers. CODEOWNERS requests a review when a PR opens, so every PR started two runs at once, one cancelling the other; any later review request did it again. A review request doesn't change the code. ready_for_review still covers drafts, and labeled stays so allow-ci still unlocks CI for outside contributors.

On #695 the old behaviour produced three test runs for one commit:

Time Event Effect
20:23:59 review requested (CODEOWNERS, on open) run 1
20:24:01 opened run 2, cancels run 1 at 0s, leaving the two literal-named failed checks
20:27:30 review requested (second reviewer) run 3, cancels run 2 after 4 minutes of tests

Trade-off: a label or approval arriving mid-run now costs one extra full run after the current one, instead of a cancellation. Skipping re-runs when the same commit already has a passing run would remove that too, but needs more logic in non-draft, so it isn't done here.

Validation

actionlint on all three files reports the same findings as main (12 pre-existing shellcheck notes in test.yml, none in the others).

@github-actions github-actions Bot added the allow-ci allow all CI integration tests label Sep 24, 2026
A run cancelled by another run for the same commit before its matrix expands leaves checks under literal names (`Tests ${{ matrix.os }}`) marked failed; no later run reports under those names, so the PR stays red after a green re-run. Cancel in-progress runs only for new code (synchronize, or a push where the workflow already cancelled on push), and drop review_requested, which fired alongside opened on every PR because CODEOWNERS requests a review on open.
@sini sini changed the title ci: stop re-running on review requests fix(ci): stop same-commit events from cancelling runs Sep 24, 2026
@sini
sini force-pushed the ci/no-rerun-on-review-request branch from b54e9c4 to 78561d7 Compare September 24, 2026 20:38
@sini
sini merged commit c8ec58c into main Sep 24, 2026
2 checks passed
@sini
sini deleted the ci/no-rerun-on-review-request branch September 24, 2026 20:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

allow-ci allow all CI integration tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant