Skip to content

Commit 75d7257

Browse files
authoredMay 14, 2020
bpo-40548: GitHub Action workflow: skip jobs on doc only PRs (pythonGH-19983)
Signed-off-by: Filipe Laíns <lains@archlinux.org>
1 parent d2dc827 commit 75d7257

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
 

‎.github/workflows/build.yml

+24
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,27 @@ on:
1616
- 3.7
1717

1818
jobs:
19+
check_source:
20+
name: 'Check for source changes'
21+
runs-on: ubuntu-latest
22+
outputs:
23+
run_tests: ${{ steps.check.outputs.run_tests }}
24+
steps:
25+
- uses: actions/checkout@v2
26+
- name: Check for source changes
27+
id: check
28+
run: |
29+
if [ -z "GITHUB_BASE_REF" ]; then
30+
echo '::set-output name=run_tests::true'
31+
else
32+
git fetch origin $GITHUB_BASE_REF --depth=1
33+
git diff --name-only origin/$GITHUB_BASE_REF... | grep -qvE '(\.rst$|^Doc|^Misc)' && echo '::set-output name=run_tests::true'
34+
fi
1935
build_win32:
2036
name: 'Windows (x86)'
2137
runs-on: windows-latest
38+
needs: check_source
39+
if: needs.check_source.outputs.run_tests == 'true'
2240
steps:
2341
- uses: actions/checkout@v1
2442
- name: Build CPython
@@ -31,6 +49,8 @@ jobs:
3149
build_win_amd64:
3250
name: 'Windows (x64)'
3351
runs-on: windows-latest
52+
needs: check_source
53+
if: needs.check_source.outputs.run_tests == 'true'
3454
steps:
3555
- uses: actions/checkout@v1
3656
- name: Build CPython
@@ -43,6 +63,8 @@ jobs:
4363
build_macos:
4464
name: 'macOS'
4565
runs-on: macos-latest
66+
needs: check_source
67+
if: needs.check_source.outputs.run_tests == 'true'
4668
steps:
4769
- uses: actions/checkout@v1
4870
- name: Configure CPython
@@ -57,6 +79,8 @@ jobs:
5779
build_ubuntu:
5880
name: 'Ubuntu'
5981
runs-on: ubuntu-latest
82+
needs: check_source
83+
if: needs.check_source.outputs.run_tests == 'true'
6084
env:
6185
OPENSSL_VER: 1.1.1f
6286
steps:

0 commit comments

Comments
 (0)