Skip to content

ci: cancel stale in-progress workflow runs when a new one starts on main#212

Merged
javi11 merged 1 commit intomainfrom
claude/funny-darwin-d02d80
Apr 25, 2026
Merged

ci: cancel stale in-progress workflow runs when a new one starts on main#212
javi11 merged 1 commit intomainfrom
claude/funny-darwin-d02d80

Conversation

@javi11
Copy link
Copy Markdown
Owner

@javi11 javi11 commented Apr 25, 2026

Summary

  • Adds a concurrency block to all workflows that trigger on main (dev-build, coverage, e2e, deploy, pull-request)
  • Uses group: ${{ github.workflow }}-${{ github.ref }} so each workflow+ref pair gets its own slot
  • Sets cancel-in-progress: true so a new push to main (or a PR branch) automatically cancels any in-progress run of the same workflow

release.yml is intentionally excluded — it only triggers on version tags, so duplicate runs aren't a concern.

How it works

Scenario Behaviour
Two commits pushed to main quickly First run is cancelled when second starts
Two commits pushed to the same PR branch First PR run is cancelled when second starts
Concurrent pushes to main and a PR Each runs independently (different github.ref)

Test plan

  • Push two commits to main in quick succession and confirm the first run is marked Cancelled in the Actions tab once the second starts
  • Confirm the second run completes successfully end-to-end

When multiple commits land on main in quick succession, duplicate
runs were queued and wasted CI minutes. Adding a concurrency group
per workflow+ref with cancel-in-progress=true ensures a new run
automatically cancels any in-progress run for the same ref.

Applies to: dev-build, coverage, e2e, deploy, and pull-request workflows.
Release workflow is excluded as it only triggers on version tags.
@javi11 javi11 merged commit ffae624 into main Apr 25, 2026
1 of 3 checks passed
@javi11 javi11 deleted the claude/funny-darwin-d02d80 branch April 25, 2026 15:25
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