Add GH action to cancel previous pending/running CI builds. (#5175)
authorMathias Preiner <mathias.preiner@gmail.com>
Thu, 1 Oct 2020 01:17:45 +0000 (18:17 -0700)
committerGitHub <noreply@github.com>
Thu, 1 Oct 2020 01:17:45 +0000 (18:17 -0700)
GH introduced a new workflow event pull_request_target that now makes it
possible to cancel builds on the base repository.

.github/workflows/ci.yml

index e9c217501331b190dad158c913d7a9d35cc2e1fa..8f8f9713966e8b29ee975d2dab57f8d0cca37ae0 100644 (file)
@@ -1,7 +1,15 @@
-on: [push, pull_request]
+on: [push, pull_request_target]
 name: CI
 
 jobs:
+  cancel:
+    runs-on: ubuntu-latest
+    steps:
+      - name: Cancel Previous Runs
+        uses: styfle/cancel-workflow-action@0.5.0
+        with:
+          access_token: ${{ github.token }}
+
   build:
     strategy:
       matrix: