[Python-checkins] [3.8] bpo-40548: GitHub Action workflow: skip jobs on doc only PRs (GH-20100)

Victor Stinner webhook-mailer at python.org
Thu May 14 23:27:56 EDT 2020


https://github.com/python/cpython/commit/07bd5cf3d9551ae84100e6400836163fcd507f07
commit: 07bd5cf3d9551ae84100e6400836163fcd507f07
branch: 3.8
author: Victor Stinner <vstinner at python.org>
committer: GitHub <noreply at github.com>
date: 2020-05-15T05:27:48+02:00
summary:

[3.8] bpo-40548: GitHub Action workflow: skip jobs on doc only PRs (GH-20100)

* bpo-40548: Always run GitHub action, even on doc PRs (GH-19981)

Always run GitHub action jobs, even on documentation-only pull
requests. So it will be possible to make a GitHub action job, like
the Windows (64-bit) job, mandatory.

(cherry picked from commit 4e363761fc02a89d53aba4382dc451293bd6f0ba)

* bpo-40548: GitHub Action workflow: skip jobs on doc only PRs (GH-19983)

Signed-off-by: Filipe Laíns <lains at archlinux.org>
(cherry picked from commit 75d7257b201a56f950c20cd9f5753a83fff4742b)

* bpo-40548: github actions: pass the changes check on no source changes (GH-20097)

Signed-off-by: Filipe Laíns <lains at archlinux.org>
(cherry picked from commit 6a78589b6b22878491a4b042bb8b3161e1d120f6)

Co-authored-by: Filipe Laíns <filipe.lains at gmail.com>
Co-authored-by: Filipe Laíns <lains at archlinux.org>

files:
M .github/workflows/build.yml

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index d3d67475135a1..27d7f15aa5931 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -1,27 +1,37 @@
 name: Tests
 
+# bpo-40548: "paths-ignore" is not used to skip documentation-only PRs, because
+# it prevents to mark a job as mandatory. A PR cannot be merged if a job is
+# mandatory but not scheduled because of "paths-ignore".
 on:
-  #push:
-  #  branches:
-  #  - master
-  #  - 3.8
-  #  - 3.7
-  #  paths-ignore:
-  #  - 'Doc/**'
-  #  - 'Misc/**'
   pull_request:
     branches:
     - master
     - 3.8
     - 3.7
-    paths-ignore:
-    - 'Doc/**'
-    - 'Misc/**'
 
 jobs:
+  check_source:
+    name: 'Check for source changes'
+    runs-on: ubuntu-latest
+    outputs:
+      run_tests: ${{ steps.check.outputs.run_tests }}
+    steps:
+      - uses: actions/checkout at 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' || 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 at v1
     - name: Build CPython
@@ -34,6 +44,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 at v1
     - name: Build CPython
@@ -46,6 +58,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 at v1
     - name: Configure CPython
@@ -60,6 +74,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:



More information about the Python-checkins mailing list