]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-40548: GitHub Action workflow: skip jobs on doc only PRs (GH-19983)
authorFilipe Laíns <filipe.lains@gmail.com>
Thu, 14 May 2020 22:11:40 +0000 (23:11 +0100)
committerGitHub <noreply@github.com>
Thu, 14 May 2020 22:11:40 +0000 (00:11 +0200)
Signed-off-by: Filipe Laíns <lains@archlinux.org>
.github/workflows/build.yml

index 6e6a6d2b789d34f82d274502dac498e5fdbd2cc0..dabfb79e9dcea127295c9ab77744b23ff9dce11e 100644 (file)
@@ -16,9 +16,27 @@ on:
     - 3.7
 
 jobs:
+  check_source:
+    name: 'Check for source changes'
+    runs-on: ubuntu-latest
+    outputs:
+      run_tests: ${{ steps.check.outputs.run_tests }}
+    steps:
+      - uses: actions/checkout@v2
+      - name: Check for source changes
+        id: check
+        run: |
+          if [ -z "GITHUB_BASE_REF" ]; then
+            echo '::set-output name=run_tests::true'
+          else
+            git fetch origin $GITHUB_BASE_REF --depth=1
+            git diff --name-only origin/$GITHUB_BASE_REF... | grep -qvE '(\.rst$|^Doc|^Misc)' && echo '::set-output name=run_tests::true'
+          fi
   build_win32:
     name: 'Windows (x86)'
     runs-on: windows-latest
+    needs: check_source
+    if: needs.check_source.outputs.run_tests == 'true'
     steps:
     - uses: actions/checkout@v1
     - name: Build CPython
@@ -31,6 +49,8 @@ jobs:
   build_win_amd64:
     name: 'Windows (x64)'
     runs-on: windows-latest
+    needs: check_source
+    if: needs.check_source.outputs.run_tests == 'true'
     steps:
     - uses: actions/checkout@v1
     - name: Build CPython
@@ -43,6 +63,8 @@ jobs:
   build_macos:
     name: 'macOS'
     runs-on: macos-latest
+    needs: check_source
+    if: needs.check_source.outputs.run_tests == 'true'
     steps:
     - uses: actions/checkout@v1
     - name: Configure CPython
@@ -57,6 +79,8 @@ jobs:
   build_ubuntu:
     name: 'Ubuntu'
     runs-on: ubuntu-latest
+    needs: check_source
+    if: needs.check_source.outputs.run_tests == 'true'
     env:
       OPENSSL_VER: 1.1.1f
     steps: