Skip to content

Commit 9edabde

Browse files
authored
fix(ci): stop cancelling main branch CI runs on concurrent pushes (#392)
## Summary - Fix concurrency groups across **3 workflows** so pushes to `main` no longer cancel each other's CI runs - Use `github.sha` (unique per push) instead of `github.ref` (shared `refs/heads/main`) for the concurrency group key on push events - Restrict `cancel-in-progress` to `pull_request` events only where applicable **Affected workflows and cancelled run counts:** | Workflow | Cancelled runs on main | Fix | |---|---|---| | Validate (`code-pull-request.yml`) | 10 | `github.sha` + `cancel-in-progress` only for PRs | | CodeQL (`codeql.yml`) | 4 | `github.sha` + `cancel-in-progress` only for PRs | | Scorecard (`scorecard.yml`) | 2 | `github.sha` + `cancel-in-progress: false` (no PR trigger) | | DCO (`dco.yml`) | 0 | No change needed (PR-only workflow) | **Trigger:** [Run 26697525843](https://github.com/archgate/cli/actions/runs/26697525843) — the `0.42.0` release validation was cancelled mid-flight when a Renovate merge (`#390`) landed 31 seconds later. Same push also cancelled [CodeQL run 26697525829](https://github.com/archgate/cli/actions/runs/26697525829). ## Test plan - [ ] This PR's own CI run completes without being cancelled - [ ] Verify the concurrency group in the Actions UI shows the commit SHA, not `refs/heads/main` - [ ] After merge, push two commits to `main` in quick succession and confirm both runs complete independently --------- Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
1 parent b5b5f94 commit 9edabde

4 files changed

Lines changed: 6 additions & 8 deletions

File tree

.github/workflows/code-pull-request.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ permissions:
1616
pull-requests: write
1717

1818
concurrency:
19-
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
20-
cancel-in-progress: true
19+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
20+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
2121

2222
env:
2323
ARCHGATE_TELEMETRY: "0"

.github/workflows/codeql.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ permissions:
1515
contents: read
1616

1717
concurrency:
18-
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
19-
cancel-in-progress: true
18+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
19+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
2020

2121
env:
2222
ARCHGATE_TELEMETRY: "0"

.github/workflows/release.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,6 @@ jobs:
153153
- name: Validate
154154
id: validate
155155
run: bun run validate
156-
- name: Ensure main is up-to-date before release
157-
run: git pull --rebase origin main
158156
- name: Release
159157
uses: TrigenSoftware/simple-release-action@e7293dad843693d8692d443c3f21b78338048f13 # v1.1.8
160158
with:

.github/workflows/scorecard.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ on:
1212
permissions: read-all
1313

1414
concurrency:
15-
group: ${{ github.workflow }}-${{ github.ref }}
16-
cancel-in-progress: true
15+
group: ${{ github.workflow }}-${{ github.sha }}
16+
cancel-in-progress: false
1717

1818
jobs:
1919
analysis:

0 commit comments

Comments
 (0)