Skip to content

ci: cancel superseded CI runs with a concurrency group#89

Merged
CGFixIT merged 1 commit into
mainfrom
claude/ci-concurrency-cancel
Jun 20, 2026
Merged

ci: cancel superseded CI runs with a concurrency group#89
CGFixIT merged 1 commit into
mainfrom
claude/ci-concurrency-cancel

Conversation

@CGFixIT

@CGFixIT CGFixIT commented Jun 20, 2026

Copy link
Copy Markdown
Owner

Summary

.github/workflows/ci.yml has no concurrency control. As a result, every push to an open PR kicks off a fresh ubuntu + windows matrix while the previous (now-stale) run for that same branch keeps executing to completion — wasting runner minutes (and a Windows runner, billed at higher weight) on code that has already been superseded.

Change

Adds a top-level concurrency group keyed on workflow + ref:

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
  • PR / feature branches: a new push cancels the prior in-flight run for that ref before starting the new one.
  • main: cancel-in-progress evaluates to false, so every commit landed on main still gets a complete, uninterrupted CI run — full history is preserved on the protected branch.

This is a pure CI cost/latency optimization — it changes nothing about what the jobs run or assert.

Note

Scoped to ci.yml (the heaviest, every-push matrix) to keep the change small and obviously correct. The same pattern could later be applied to the other matrix workflows (e.g. pip-audit.yml) if desired.

🤖 Generated with Claude Code


Generated by Claude Code

The CI workflow had no concurrency control, so every push to an open PR
started a fresh ubuntu + windows matrix while the previous (now-stale) run
kept executing to completion — burning runner minutes on code that has
already been replaced.

Adds a top-level concurrency group keyed on workflow + ref:
  - cancel-in-progress cancels prior in-flight runs for the same PR/branch
    when new commits arrive.
  - Pushes to main are exempt (cancel-in-progress evaluates to false on
    refs/heads/main) so main retains complete, uninterrupted CI history.

No change to what the jobs do — purely a CI cost/latency optimization.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0167bHerb53KwtsHWVNt9qkg
@CGFixIT CGFixIT marked this pull request as ready for review June 20, 2026 15:06
@CGFixIT CGFixIT merged commit 2fc1dea into main Jun 20, 2026
14 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