github: Prevent duplicate CI runs
authorTobias Brunner <tobias@strongswan.org>
Fri, 11 Dec 2020 15:30:04 +0000 (16:30 +0100)
committerTobias Brunner <tobias@strongswan.org>
Tue, 15 Dec 2020 09:42:43 +0000 (10:42 +0100)
This cancels previous runs of the same branch and skips runs of the same
content (e.g. after merges or tags).

.github/workflows/android.yml
.github/workflows/lgtm.yml
.github/workflows/linux.yml
.github/workflows/macos.yml
.github/workflows/sonarcloud.yml
.github/workflows/windows.yml

index 567c507..b4f1bac 100644 (file)
@@ -10,7 +10,19 @@ env:
   OS_NAME: linux
 
 jobs:
+  pre-check:
+    runs-on: ubuntu-latest
+    outputs:
+      should_skip: ${{ steps.skip-check.outputs.should_skip }}
+    steps:
+      - id: skip-check
+        uses: fkirc/skip-duplicate-actions@master
+        with:
+          concurrent_skipping: 'same_content'
+
   android:
+    needs: pre-check
+    if: ${{ needs.pre-check.outputs.should_skip != 'true' }}
     runs-on: ubuntu-latest
     env:
       TEST: android
index 8d6fd54..f527b29 100644 (file)
@@ -6,7 +6,19 @@ env:
   OS_NAME: linux
 
 jobs:
+  pre-check:
+    runs-on: ubuntu-latest
+    outputs:
+      should_skip: ${{ steps.skip-check.outputs.should_skip }}
+    steps:
+      - id: skip-check
+        uses: fkirc/skip-duplicate-actions@master
+        with:
+          concurrent_skipping: 'same_content'
+
   lgtm:
+    needs: pre-check
+    if: ${{ needs.pre-check.outputs.should_skip != 'true' }}
     runs-on: ubuntu-latest
     env:
       TEST: lgtm
index fc51cd3..442628b 100644 (file)
@@ -13,7 +13,19 @@ env:
   OS_NAME: linux
 
 jobs:
+  pre-check:
+    runs-on: ubuntu-latest
+    outputs:
+      should_skip: ${{ steps.skip-check.outputs.should_skip }}
+    steps:
+      - id: skip-check
+        uses: fkirc/skip-duplicate-actions@master
+        with:
+          concurrent_skipping: 'same_content'
+
   latest:
+    needs: pre-check
+    if: ${{ needs.pre-check.outputs.should_skip != 'true' }}
     runs-on: ubuntu-latest
     strategy:
       matrix:
@@ -72,6 +84,8 @@ jobs:
           retention-days: 5
 
   crypto-plugins:
+    needs: pre-check
+    if: ${{ needs.pre-check.outputs.should_skip != 'true' }}
     runs-on: ubuntu-latest
     strategy:
       matrix:
@@ -108,6 +122,8 @@ jobs:
           retention-days: 5
 
   xenial:
+    needs: pre-check
+    if: ${{ needs.pre-check.outputs.should_skip != 'true' }}
     runs-on: ubuntu-16.04
     strategy:
       matrix:
index 1528f3f..c89678a 100644 (file)
@@ -10,7 +10,19 @@ env:
   OS_NAME: macos
 
 jobs:
+  pre-check:
+    runs-on: ubuntu-latest
+    outputs:
+      should_skip: ${{ steps.skip-check.outputs.should_skip }}
+    steps:
+      - id: skip-check
+        uses: fkirc/skip-duplicate-actions@master
+        with:
+          concurrent_skipping: 'same_content'
+
   macos:
+    needs: pre-check
+    if: ${{ needs.pre-check.outputs.should_skip != 'true' }}
     runs-on: macos-latest
     env:
       TEST: macos
index aa6a411..293cbe2 100644 (file)
@@ -9,7 +9,19 @@ env:
   OS_NAME: linux
 
 jobs:
+  pre-check:
+    runs-on: ubuntu-latest
+    outputs:
+      should_skip: ${{ steps.skip-check.outputs.should_skip }}
+    steps:
+      - id: skip-check
+        uses: fkirc/skip-duplicate-actions@master
+        with:
+          concurrent_skipping: 'same_content'
+
   sonarcloud:
+    needs: pre-check
+    if: ${{ needs.pre-check.outputs.should_skip != 'true' }}
     runs-on: ubuntu-latest
     env:
       TEST: sonarcloud
index 073bd27..31334c5 100644 (file)
@@ -13,7 +13,19 @@ env:
   MONOLITHIC: yes
 
 jobs:
+  pre-check:
+    runs-on: ubuntu-latest
+    outputs:
+      should_skip: ${{ steps.skip-check.outputs.should_skip }}
+    steps:
+      - id: skip-check
+        uses: fkirc/skip-duplicate-actions@master
+        with:
+          concurrent_skipping: 'same_content'
+
   cross-compile:
+    needs: pre-check
+    if: ${{ needs.pre-check.outputs.should_skip != 'true' }}
     runs-on: ubuntu-latest
     strategy:
       matrix: