From 607908924c5e34cc004c6b8278641f37b24e63cf Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Wed, 15 Feb 2023 03:35:15 +0000 Subject: [PATCH] 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. --- .github/workflows/builddoc.yml | 2 +- .github/workflows/latex.yml | 2 +- .github/workflows/lint.yml | 2 +- .github/workflows/main.yml | 2 +- .github/workflows/nodejs.yml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/builddoc.yml b/.github/workflows/builddoc.yml index d80a4bafb..3b9609b7a 100644 --- a/.github/workflows/builddoc.yml +++ b/.github/workflows/builddoc.yml @@ -6,7 +6,7 @@ permissions: contents: read concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: diff --git a/.github/workflows/latex.yml b/.github/workflows/latex.yml index 1eaeccaa9..857a6ede8 100644 --- a/.github/workflows/latex.yml +++ b/.github/workflows/latex.yml @@ -6,7 +6,7 @@ permissions: contents: read concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index bbcf14233..683eec2dd 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -6,7 +6,7 @@ permissions: contents: read concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true env: diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 108e5d83e..a299029c9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,7 +6,7 @@ permissions: contents: read concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true env: diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 184d33211..d02174857 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -6,7 +6,7 @@ permissions: contents: read concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: