Skip to content

Commit cebbdc6

Browse files
jimmygchenWoodpile37
authored andcommitted
Use the native concurrency property to cancel workflows (sigp#4572)
I noticed that some of our workflows aren't getting cancelled when a new one has been triggered, so we ended up having a long queue in our CI when multiple changes are triggered in a short period. Looking at the comment here, I noticed the list of workflow IDs are outdated and no longer exist, and some new ones are missing: https://github.com/sigp/lighthouse/blob/dfcb3363c757671eb19d5f8e519b4b94ac74677a/.github/workflows/cancel-previous-runs.yml#L12-L13 I attempted to update these, and came across this comment on the [`cancel-workflow-action`](https://github.com/styfle/cancel-workflow-action) repo: > You probably don't need to install this custom action. > > Instead, use the native [concurrency](https://github.blog/changelog/2021-04-19-github-actions-limit-workflow-run-or-job-concurrency/) property to cancel workflows, for example: So I thought instead of updating the workflow and maintaining the workflow IDs, perhaps we can try experimenting the [native `concurrency` property](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency).
1 parent d9930db commit cebbdc6

File tree

8 files changed

+29
-14
lines changed

8 files changed

+29
-14
lines changed

.github/workflows/book.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ on:
55
branches:
66
- unstable
77

8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
812
jobs:
913
build-and-upload-to-s3:
1014
runs-on: ubuntu-20.04

.github/workflows/cancel-previous-runs.yml

Lines changed: 0 additions & 14 deletions
This file was deleted.

.github/workflows/docker-antithesis.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ on:
55
branches:
66
- unstable
77

8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
812
env:
913
ANTITHESIS_PASSWORD: ${{ secrets.ANTITHESIS_PASSWORD }}
1014
ANTITHESIS_USERNAME: ${{ secrets.ANTITHESIS_USERNAME }}

.github/workflows/docker.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ on:
1010
tags:
1111
- v*
1212

13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: true
16+
1317
env:
1418
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
1519
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}

.github/workflows/linkcheck.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ on:
99
- 'book/**'
1010
merge_group:
1111

12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: true
15+
1216
jobs:
1317
linkcheck:
1418
name: Check broken links

.github/workflows/local-testnet.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ on:
88
pull_request:
99
merge_group:
1010

11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
1115
jobs:
1216
run-local-testnet:
1317
strategy:

.github/workflows/release.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ on:
55
tags:
66
- v*
77

8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
812
env:
913
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
1014
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}

.github/workflows/test-suite.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ on:
99
- 'pr/*'
1010
pull_request:
1111
merge_group:
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: true
16+
1217
env:
1318
# Deny warnings in CI
1419
# Disable debug info (see https://github.com/sigp/lighthouse/issues/4005)

0 commit comments

Comments
 (0)