Skip to content

Commit 8e392d3

Browse files
committed
Cancel in-progress workflow runs on new pushes to the same ref via concurrency groups
1 parent af156d1 commit 8e392d3

7 files changed

Lines changed: 40 additions & 0 deletions

File tree

.github/workflows/account.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ on:
2525
- "!**.md"
2626
workflow_dispatch:
2727

28+
concurrency:
29+
group: account-${{ github.ref }}
30+
# Cancel superseded runs on pull requests, but never on main — main runs trigger deploys, and
31+
# cancelling a parent workflow propagates into the called reusable deploy workflow, so a
32+
# mid-deploy cancel could leave a container app or migration in a half-applied state.
33+
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
34+
2835
permissions:
2936
id-token: write
3037
contents: read

.github/workflows/app-gateway.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ on:
2121
- "!**.md"
2222
workflow_dispatch:
2323

24+
concurrency:
25+
group: app-gateway-${{ github.ref }}
26+
# Cancel superseded runs on pull requests, but never on main — main runs trigger deploys, and
27+
# cancelling a parent workflow propagates into the called reusable deploy workflow, so a
28+
# mid-deploy cancel could leave a container app in a half-applied state.
29+
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
30+
2431
permissions:
2532
id-token: write
2633
contents: read

.github/workflows/cloud-infrastructure.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ on:
1717
- "!**.md"
1818
workflow_dispatch:
1919

20+
concurrency:
21+
group: cloud-infrastructure-${{ github.ref }}
22+
# Cancel superseded runs on pull requests, but never on main — main runs trigger infrastructure
23+
# deploys, and cancelling a parent workflow propagates into the called reusable deploy workflow,
24+
# so a mid-deploy cancel could leave Bicep in a half-applied state.
25+
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
26+
2027
permissions:
2128
id-token: write
2229
contents: read

.github/workflows/code-style.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ on:
1717
- "!**.md"
1818
workflow_dispatch:
1919

20+
concurrency:
21+
group: code-style-${{ github.ref }}
22+
cancel-in-progress: true
23+
2024
permissions:
2125
id-token: write
2226
contents: read

.github/workflows/developer-cli.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ on:
1515
- "!**.md"
1616
workflow_dispatch:
1717

18+
concurrency:
19+
group: developer-cli-${{ github.ref }}
20+
cancel-in-progress: true
21+
1822
permissions:
1923
contents: read
2024

.github/workflows/main.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ on:
2525
- "!**.md"
2626
workflow_dispatch:
2727

28+
concurrency:
29+
group: main-${{ github.ref }}
30+
# Cancel superseded runs on pull requests, but never on main — main runs trigger deploys, and
31+
# cancelling a parent workflow propagates into the called reusable deploy workflow, so a
32+
# mid-deploy cancel could leave a container app or migration in a half-applied state.
33+
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
34+
2835
permissions:
2936
id-token: write
3037
contents: read

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ on:
44
pull_request:
55
types: [opened, synchronize, reopened, edited, labeled, unlabeled]
66

7+
concurrency:
8+
group: pull-request-conventions-${{ github.ref }}
9+
cancel-in-progress: true
10+
711
permissions:
812
contents: read
913
pull-requests: write

0 commit comments

Comments
 (0)