Skip to content

Commit 1aada28

Browse files
authored
Make sure Github action workflows are correctly canceled. (#5232)
Signed-off-by: fruffy <[email protected]>
1 parent 7b49eb1 commit 1aada28

File tree

6 files changed

+40
-15
lines changed

6 files changed

+40
-15
lines changed

.github/workflows/ci-lint.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ on:
88
merge_group:
99
branches: [main]
1010

11+
# Cancel any preceding run on the pull request.
12+
concurrency:
13+
group: p4c-lint-${{ github.event.pull_request.number || github.ref }}
14+
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
15+
1116
jobs:
1217
p4c-lint:
1318
runs-on: ubuntu-22.04

.github/workflows/ci-ubuntu-18-nightly.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ on:
99
push:
1010
branches: [main]
1111

12+
# Cancel any preceding run on the pull request.
13+
concurrency:
14+
group: test-ubuntu18-${{ github.event.pull_request.number || github.ref }}
15+
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
16+
1217
jobs:
1318
# Build with GCC and test p4c on Ubuntu 18.04.
1419
test-ubuntu18:

.github/workflows/ci-ubuntu-22-sanitizer-nightly.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ on:
99
push:
1010
branches: [main]
1111

12+
# Cancel any preceding run on the pull request.
13+
concurrency:
14+
group: test-ubuntu22-clang-sanitizers-${{ github.event.pull_request.number || github.ref }}
15+
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
16+
1217
jobs:
1318
# Build with clang and test p4c on Ubuntu 22.04.
1419
test-ubuntu22-clang-sanitizers:

.github/workflows/ci-ubuntu-p4tc-stf.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ on:
99
push:
1010
branches: [main]
1111

12+
# Cancel any preceding run on the pull request.
13+
concurrency:
14+
group: test-ubuntu-p4tc-stf-${{ github.event.pull_request.number || github.ref }}
15+
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
16+
1217
jobs:
1318
# Run p4tc stf tests
1419
test-ubuntu-p4tc-stf:

.github/workflows/ci-validation-nightly.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ on:
99
push:
1010
branches: [main]
1111

12+
# Cancel any preceding run on the pull request.
13+
concurrency:
14+
group: validate-${{ github.event.pull_request.number || github.ref }}
15+
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
16+
1217
jobs:
1318
# We run validation in parallel with the normal tests.
1419
# Validation ensures that P4C compiles P4-16 programs correctly.

.github/workflows/deploy-docs.yml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
name: Build Doxygen and deploy to GitHub Pages
22
permissions:
3-
actions: read
4-
contents: write
5-
pages: write
6-
issues: write
7-
pull-requests: write
3+
actions: read
4+
contents: write
5+
pages: write
6+
issues: write
7+
pull-requests: write
88

99
on:
10-
push:
11-
branches:
12-
- main
13-
pull_request_target:
14-
types: [opened, synchronize, reopened, ready_for_review, labeled]
10+
push:
11+
branches:
12+
- main
13+
pull_request_target:
14+
types: [opened, synchronize, reopened, ready_for_review, labeled]
1515

1616
jobs:
1717
build-and-deploy:
@@ -24,7 +24,7 @@ jobs:
2424
DEPLOYMENT: '<img src="https://github.com/user-attachments/assets/f94fada5-45ca-4271-9106-180728235ad2" alt="Rocket" width="25"/>'
2525
CELEBRATION: '<img src="https://github.com/user-attachments/assets/86eb8470-c597-4f8b-a77d-a54036075271" alt="githubloading" width="25"/>'
2626
FAILURE_ICON: '<img src="https://github.com/user-attachments/assets/af921ba9-953d-465e-b597-64ed0a2dc921" alt="failed" width="25"/>'
27-
COMMENT_IDENTIFIER: '<!-- preview-comment -->'
27+
COMMENT_IDENTIFIER: "<!-- preview-comment -->"
2828

2929
concurrency: ci-${{ github.ref }}
3030
steps:
@@ -54,7 +54,7 @@ jobs:
5454
uses: peter-evans/find-comment@v3
5555
with:
5656
issue-number: ${{ github.event.pull_request.number }}
57-
comment-author: 'github-actions[bot]'
57+
comment-author: "github-actions[bot]"
5858
body-includes: ${{ env.COMMENT_IDENTIFIER }}
5959

6060
- name: Post Initial Comment
@@ -85,7 +85,7 @@ jobs:
8585
uses: peter-evans/find-comment@v3
8686
with:
8787
issue-number: ${{ github.event.pull_request.number }}
88-
comment-author: 'github-actions[bot]'
88+
comment-author: "github-actions[bot]"
8989
body-includes: ${{ env.COMMENT_IDENTIFIER }}
9090

9191
- name: Install Clang
@@ -158,10 +158,10 @@ jobs:
158158
| -- | -- |
159159
| 📂 **View the source code here:** | [View Source Code](https://github.com/${{ github.repository }}/tree/gh-pages/pr-preview/${{ github.event.pull_request.number }}) |
160160
| 🔧 **Commit used for deployment:** | [${{ github.event.pull_request.head.sha }}](https://github.com/${{ github.repository }}/commit/${{ github.event.pull_request.head.sha }}) |
161-
161+
162162
**Note:** Changes may take a few seconds to appear on GitHub Pages. Please refresh the page if you do not see the updates immediately.
163163
${{ env.COMMENT_IDENTIFIER }}
164-
edit-mode: replace
164+
edit-mode: replace
165165

166166
- name: Update Comment with Failure Message
167167
if: ${{ github.event_name == 'pull_request_target' && steps.check-label.outputs.result == 'true' && failure() }}

0 commit comments

Comments
 (0)