Repository navigation
ci: cancel PR runs only for new commits - #473
Merged
Merged
Conversation
A newer run on the same commit (e.g. for an edit of the description) cancelled the run in progress, and its failed gate then blocked the merge. Only the first attempt of a run for a pull request's synchronize action now cancels runs in progress, as in "Cancelled runs" of actions/gate/README.md in elixir-cloud-aai/.github. Part of elixir-cloud-aai/.github#73 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #473 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 31 31
Lines 3007 3007
=========================================
Hits 3007 3007 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
uniqueg
marked this pull request as ready for review
November 10, 2026 20:11
Reviewer's GuideConfigurationRestrict workflow cancellation to first-attempt pull-request synchronize runs while documenting the rule and preserving the existing concurrency groups.
TestsAssert the cancellation condition and the complete concurrency-group expression, including the separate push grouping.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="tests/test_workflows.py" line_range="94" />
<code_context>
+ " && github.run_attempt == 1 }}"
+ )
+ group = " ".join(concurrency["group"].split())
+ assert "github.event_name == 'push' && github.sha ||" in group
+
+
</code_context>
<issue_to_address>
**Push runs can be dropped**
When the workflow group expression is prefixed with `false &&`, `test_ci_concurrency` line 94 only checks that the group contains the push-and-SHA substring. Prefixing the expression with `false &&` makes it use the fallback group for pushes, so successive pushes can replace queued runs, yet the assertion still passes.
Assert that the group expression uses the push-and-SHA branch as its active first alternative, rather than checking only for a substring.
</issue_to_address>Sourcery assessment
Approval pending. 1 finding to address first.
Blocking findings: tests/test_workflows.py:94
A substring check of the push branch would pass even if an earlier branch of the expression gave all pushes one group (Sourcery). Part of elixir-cloud-aai/.github#73 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
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
Only a new head commit of a pull request now cancels its CI runs in progress:
cancel-in-progressof the workflow-levelconcurrencyblock in.github/workflows/ci.ymlis true only forpull_requestwith actionsynchronizeon the first attempt, as in "Cancelled runs" ofactions/gate/README.mdin elixir-cloud-aai/.github (elixir-cloud-aai/.github#71):Before, a newer run on the same commit (e.g. for editing the description, also by Sourcery, or marking the pull request ready) cancelled the run in progress, and its failed
CI passedwas then the newest result on the commit, which blocked the merge (elixir-cloud-aai/.github#70). Runs for other actions, and reruns, now wait for the run in progress instead; a waiting run that is replaced starts no job, so it leaves no check. The gate keepsif: always(), so a needed job that failed or was cancelled still fails it. This pull request's own runs already use the new rule.The concurrency groups are unchanged (runs for pushes and for edits that leave the title unchanged keep groups of their own); the comment above the block now describes the new rule.
tests/test_workflows.pygetstest_ci_concurrency, which asserts the new expression and the whole group expression, in which runs for pushes have a group of their own (written first; it failed before the change).Part of elixir-cloud-aai/.github#73
Verification
pre-commit run --fileson.github/workflows/ci.ymland the test file (all hooks of the repository): passed.pytest tests/test_workflows.py -k concurrency: failed before the change, passes after it.pytest -W ignore::DeprecationWarning: 1617 passed, 11 skipped, 188 failed, all intests/test_chart.py(186) andtests/test_config_examples.py::test_chart_examples_valid(2): the chart tests (tests/test_chart.py, and the chart examples intests/test_config_examples.py) could not run locally, as Helm isn't installed here; CI runs them.CI passed, on 3be015e.Light lane: changes only the CI workflow's concurrency settings and a test of them (no secrets, permissions or release workflow); I reviewed the diff myself.
Declined review findings
None.
Open questions
None.
🤖 Generated with Claude Code
https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV