ci: prevent concurrency cancellation on rapid main merges

The concurrency group used github.ref which is static for main
(refs/heads/main). When multiple PRs merged rapidly (~2 min apart),
each merge commit cancelled the previous CI run before it could finish.

Fix: use github.sha for push events to main (unique per commit) while
keeping the ref-based group for PR branches (cancels on new commits to
the same PR branch).

Co-authored-by: ronia <ronia@m57>
This commit is contained in:
M57andronia authored and GitHub committed 2026-06-19 20:33:36 +03:00
1 parent 8519add306
commit b0ba1b7f00
1 file changed
+4 -2
+4 -2
View File
@@ -11,9 +11,11 @@ on:
branches: [main]
workflow_dispatch:
# Cancel in-progress runs on the same ref when a new commit lands.
# Cancel in-progress runs when a new commit lands on the same PR branch.
# On main (push events), each commit gets a unique group so rapid merges
# don't cancel each other's CI runs.
concurrency:
group: ci-${{ github.ref }}
group: ci-${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.sha }}
cancel-in-progress: true
jobs: