Skip to content

Commit 8dbf440

Browse files
committed
Add concurrency control to prevent redundant workflow runs
Implement workflow-level concurrency control to optimize CI resource usage: - Group by workflow name and git ref (branch/tag) - Cancel in-progress runs when new commits are pushed - Prevents multiple CI runs for the same branch running simultaneously This addresses the issue where rapid pushes to the same branch would spawn multiple workflow instances, wasting GitHub Actions runner time and delaying feedback on the latest commit. Example behavior: - Push A triggers workflow run 1 - Push B to same branch triggers workflow run 2 - Run 1 is automatically cancelled, run 2 proceeds Concurrency group format: "CI-refs/heads/branch-name"
1 parent 34b750e commit 8dbf440

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

.github/workflows/main.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ name: CI
22

33
on: [push, pull_request]
44

5+
concurrency:
6+
group: ${{ github.workflow }}-${{ github.ref }}
7+
cancel-in-progress: true
8+
59
permissions:
610
contents: read
711

0 commit comments

Comments
 (0)