Skip to content

Commit 6079089

Browse files
committed
Always cancel in-progress workflows on new commits
The current ``github.head_ref || github.run_id`` syntax only cancels in-progress GitHub Actions runs triggered by pull requests, as ``head_ref`` is only defined for pull requests, and ``run_id`` is always unique. This changes to using ``ref``, which is the name of the branch or tag linked to the commit, meaning that in-progress jobs will be cancelled on pushes to a branch.
1 parent ff852bc commit 6079089

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

.github/workflows/builddoc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ permissions:
66
contents: read
77

88
concurrency:
9-
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
9+
group: ${{ github.workflow }}-${{ github.ref }}
1010
cancel-in-progress: true
1111

1212
jobs:

.github/workflows/latex.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ permissions:
66
contents: read
77

88
concurrency:
9-
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
9+
group: ${{ github.workflow }}-${{ github.ref }}
1010
cancel-in-progress: true
1111

1212
jobs:

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ permissions:
66
contents: read
77

88
concurrency:
9-
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
9+
group: ${{ github.workflow }}-${{ github.ref }}
1010
cancel-in-progress: true
1111

1212
env:

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ permissions:
66
contents: read
77

88
concurrency:
9-
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
9+
group: ${{ github.workflow }}-${{ github.ref }}
1010
cancel-in-progress: true
1111

1212
env:

.github/workflows/nodejs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ permissions:
66
contents: read
77

88
concurrency:
9-
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
9+
group: ${{ github.workflow }}-${{ github.ref }}
1010
cancel-in-progress: true
1111

1212
jobs:

0 commit comments

Comments
 (0)