Skip to content

Commit 157c87c

Browse files
Cancel superseded CI runs on pull requests (#1500)
<!-- Thank you for your contribution! --> ## What do these changes do? Adds a `concurrency` group to the CI/CD workflow so that pushing a new commit to a pull request cancels the still running or pending run for the previous commit. Pull request runs are grouped by PR number. Every other event (pushes to `master` and release branches, tags, the merge queue, the daily schedule) falls back to `github.run_id`, so each of those runs gets a unique group and is never cancelled or replaced while pending. Grouping those by `github.ref` with a conditional `cancel-in-progress` would not be enough, since GitHub keeps only one pending run per group and silently drops the older one. ## Are there changes in behavior for the user? No, this only affects CI. ## Is it a substantial burden for the maintainers to support this? No. ## Related issue number N/A ## Checklist - [x] I think the code is well written - [ ] Unit tests for the changes exist: N/A, CI configuration only - [ ] Documentation reflects the changes: N/A - [ ] If you provide code modification, please add yourself to `CONTRIBUTORS.txt`: N/A - [x] Add a new news fragment into the `CHANGES/` folder - [x] `make doc-spelling` passes and any new technical words are added to `docs/spelling_wordlist.txt` Drafted with Claude Code (Claude Opus 5); reviewed by @asvetlov. <details> <summary>Agent run details (optional, for reviewers)</summary> Lint: `pre-commit run --files .github/workflows/ci-cd.yml` passes (workflow schema, timeout-minutes, yamllint). Docs: `make doc-spelling` passes. The cancellation behaviour itself can only be observed on GitHub Actions; it was not exercised locally. </details> --------- Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
1 parent d43adfe commit 157c87c

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

‎.github/workflows/ci-cd.yml‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ on:
1515
schedule:
1616
- cron: 0 6 * * * # Daily 6AM UTC build
1717

18+
concurrency:
19+
group: >-
20+
${{ github.workflow }}-${{
21+
github.event.pull_request.number || github.run_id
22+
}}
23+
cancel-in-progress: true
24+
1825

1926
env:
2027
COLOR: >- # Supposedly, pytest or coveragepy use this

‎CHANGES/1500.contrib.rst‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
The CI/CD workflow was updated to stop superseded runs of the same pull request
2+
when a new commit is pushed; runs on ``master``, release branches, tags,
3+
the merge queue, and the daily schedule are never interrupted
4+
-- by :user:`asvetlov`.

0 commit comments

Comments
 (0)