Use native cancellation mechanism (#8311)
authorGereon Kremer <gkremer@cs.stanford.edu>
Wed, 16 Mar 2022 20:54:12 +0000 (21:54 +0100)
committerGitHub <noreply@github.com>
Wed, 16 Mar 2022 20:54:12 +0000 (20:54 +0000)
Github actions have a native mechanism to cancel previous runs of the same workflow now, much like the cancel workflow we have.

.github/workflows/cancel.yml [deleted file]
.github/workflows/ci.yml

diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml
deleted file mode 100644 (file)
index 9691fe2..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-
-name: Cancel
-on:
-  workflow_run:
-    workflows: ["CI"]
-    types:
-      - requested
-
-jobs:
-  cancel:
-    runs-on: ubuntu-latest
-    steps:
-      - uses: styfle/cancel-workflow-action@0.9.1
-        with:
-          workflow_id: ${{ github.event.workflow.id }}
index 543641042887ef26b91ae8a764068ed269f68749..f4a8b72424bd81d6df999ce10e42238b5193b010 100644 (file)
@@ -54,6 +54,11 @@ jobs:
     name: ${{ matrix.name }}
     runs-on: ${{ matrix.os }}
 
+    # cancel already running jobs for the same branch/pr/tag
+    concurrency:
+      group: build-${{ github.ref }}-${{ matrix.name }}
+      cancel-in-progress: true
+
     steps:
 
     - uses: actions/checkout@v2