From 68afb7be05f2560cac95d10827b96902fd328472 Mon Sep 17 00:00:00 2001 From: John Omotani Date: Fri, 16 Jul 2021 14:51:15 +0100 Subject: [PATCH 1/2] Cancel previous CI runs on new push to branch --- .github/workflows/test.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 055f8b5..f205382 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,6 +10,10 @@ on: # https://crontab.guru/#0_0_1_*_* - cron: "0 0 1 * *" +concurrency: + group: ${{ github.workflow}}-${{ github.ref }} + cancel-in-progress: true + jobs: # As we are running on different environments, we are splitting the jobs # https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#jobs From f42d578d54207117d59d612353728de0fd8f6bb4 Mon Sep 17 00:00:00 2001 From: johnomotani Date: Wed, 28 Jul 2021 18:32:09 +0100 Subject: [PATCH 2/2] Cancel all old workflows from first new workflow Remove specific `${{ github.workflow }}` in the 'concurrency' group, so that any job starting on a branch will cancel all old jobs. Useful for when the CI is busy, so it may take some time for all jobs to start. A `${{ github.workflow }}` probably should be added if we have a documentation-building CI in future, which we might want to trigger on its own while tests still run on a previous commit. --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f205382..31ac7d9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,7 +11,7 @@ on: - cron: "0 0 1 * *" concurrency: - group: ${{ github.workflow}}-${{ github.ref }} + group: ${{ github.ref }} cancel-in-progress: true jobs: