Explorar el Código

CI - prevent CI/CD from running when commit is for website content.
[ci skip]

Yao Wei Tjong 姚伟忠 hace 4 años
padre
commit
6c3d6a33e0
Se han modificado 1 ficheros con 16 adiciones y 0 borrados
  1. 16 0
      .github/workflows/main.yml

+ 16 - 0
.github/workflows/main.yml

@@ -25,9 +25,23 @@
 name: CI/CD
 on: [push, pull_request]
 jobs:
+  init:
+    name: init
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v2
+        with: { fetch-depth: 0 }
+      - name: What changed
+        id: whatchanged
+        run: echo ::set-output name=skip::$(git whatchanged -1 |grep '^:' |grep -cqv 'website/'; echo $?)
+      - name: Proceed
+        run: true
+        if: steps.whatchanged.outputs.skip == '0'
   linux:
     name: 🐧
     runs-on: ubuntu-latest
+    needs: init
     strategy:
       fail-fast: false
       matrix:
@@ -158,6 +172,7 @@ jobs:
   macOS:
     name: 🍏
     runs-on: macos-latest
+    needs: init
     strategy:
       fail-fast: false
       matrix:
@@ -217,6 +232,7 @@ jobs:
   windows:
     name: 🔲
     runs-on: windows-latest
+    needs: init
     strategy:
       fail-fast: false
       matrix: