ci: skip redundant push-triggered runs cleanly instead of cancelling them#325
Merged
Merged
Conversation
…them The concurrency-cancel fix from #323 dedupes push+pull_request duplicate runs on the same commit, but a cancelled run's jobs surface as failed-looking red X's in the PR checks list (confirmed live on #324: run 29046387852 was cancelled mid-flight, its 6 jobs all showing "fail" in `gh pr checks`) -- not acceptable even though it doesn't block merging. Replace it with a `gate` job: for push events, it checks (via `gh pr list`) whether the pushed commit is already the head of an open PR. If so, that PR's own pull_request-triggered run already provides full coverage, so every other job's `if: needs.gate.outputs.proceed == 'true'` skips them outright -- before any real job starts, showing a clean neutral "skipped" instead of cancelled/failed. pull_request- triggered runs always proceed (gate is a no-op for them), and ordinary pushes with no open PR are unaffected.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
concurrencygroup withcancel-in-progress: true.developwhile ci: dedupe concurrent CI runs on identical commit (push + pull_request) #324 (the follow-on release PR) was open, and thepush-triggered run (29046387852) got cancelled mid-flight, with all 6 of its remaining jobs reported asfailbygh pr checks.gatejob. Forpushevents, it queriesgh pr listto check whether the pushed commit is already the head of an open PR; if so, that PR's ownpull_request-triggered run already covers it, and every other job'sif: needs.gate.outputs.proceed == 'true'skips them before any real job starts — a clean, neutral "skipped" instead of a cancelled/failed one.pull_request-triggered runs always proceed unaffected (gate is a no-op for them), and a plain push with no open PR runs full CI exactly as before.Test plan
.github/workflows/ci.ymlvalidated as well-formed YAML; every job confirmed to carryneeds: gate+ theifguarddevelopwhile adevelop→mainrelease PR is open: expect the push-triggered run's jobs to showskipped, notcancelled/fail