From 3fdb3f832af56a4afc38da1691fff3ca6596bf20 Mon Sep 17 00:00:00 2001 From: Massimiliano Culpo Date: Thu, 9 Jun 2022 00:46:46 +0200 Subject: Cancel running workflows automatically on PR update (#31044) * Cancel running workflows automatically on PR update * Add the last update later to check cancellation is working * Use github.run_number instead of github.sha --- .github/workflows/bootstrap.yml | 4 ++++ .github/workflows/build-containers.yml | 4 ++++ .github/workflows/macos_python.yml | 4 ++++ .github/workflows/unit_tests.yaml | 5 +++++ .github/workflows/windows_python.yml | 5 +++++ 5 files changed, 22 insertions(+) (limited to '.github') diff --git a/.github/workflows/bootstrap.yml b/.github/workflows/bootstrap.yml index 3780429386..fce8c81d1f 100644 --- a/.github/workflows/bootstrap.yml +++ b/.github/workflows/bootstrap.yml @@ -19,6 +19,10 @@ on: # nightly at 2:16 AM - cron: '16 2 * * *' +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_number }} + cancel-in-progress: true + jobs: fedora-clingo-sources: diff --git a/.github/workflows/build-containers.yml b/.github/workflows/build-containers.yml index 5057a89a45..90e01b67af 100644 --- a/.github/workflows/build-containers.yml +++ b/.github/workflows/build-containers.yml @@ -19,6 +19,10 @@ on: release: types: [published] +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_number }} + cancel-in-progress: true + jobs: deploy-images: runs-on: ubuntu-latest diff --git a/.github/workflows/macos_python.yml b/.github/workflows/macos_python.yml index 130a1bf70b..55e3997d0e 100644 --- a/.github/workflows/macos_python.yml +++ b/.github/workflows/macos_python.yml @@ -16,6 +16,10 @@ on: - '.github/workflows/macos_python.yml' # TODO: run if we touch any of the recipes involved in this +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_number }} + cancel-in-progress: true + # GitHub Action Limits # https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions diff --git a/.github/workflows/unit_tests.yaml b/.github/workflows/unit_tests.yaml index 66cf79380e..6de8ce7fed 100644 --- a/.github/workflows/unit_tests.yaml +++ b/.github/workflows/unit_tests.yaml @@ -9,6 +9,11 @@ on: branches: - develop - releases/** + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_number }} + cancel-in-progress: true + jobs: # Validate that the code can be run on all the Python versions # supported by Spack diff --git a/.github/workflows/windows_python.yml b/.github/workflows/windows_python.yml index 4707cab416..1b3332fef5 100644 --- a/.github/workflows/windows_python.yml +++ b/.github/workflows/windows_python.yml @@ -9,6 +9,11 @@ on: branches: - develop - releases/** + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_number }} + cancel-in-progress: true + defaults: run: shell: -- cgit v1.2.3-60-g2f50