Skip to content

Commit 6ad51a1

Browse files
[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 4e36376) * bpo-40548: GitHub Action workflow: skip jobs on doc only PRs (GH-19983) Signed-off-by: Filipe Laíns <lains@archlinux.org> (cherry picked from commit 75d7257) * bpo-40548: github actions: pass the changes check on no source changes (GH-20097) Signed-off-by: Filipe Laíns <lains@archlinux.org> (cherry picked from commit 6a78589) Co-authored-by: Filipe Laíns <filipe.lains@gmail.com> Co-authored-by: Filipe Laíns <lains@archlinux.org> (cherry picked from commit 07bd5cf) Co-authored-by: Victor Stinner <vstinner@python.org>
1 parent c1203b7 commit 6ad51a1

File tree

1 file changed

+27
-11
lines changed

1 file changed

+27
-11
lines changed

‎.github/workflows/build.yml

+27-11
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,37 @@
11
name: Tests
22

3+
# bpo-40548: "paths-ignore" is not used to skip documentation-only PRs, because
4+
# it prevents to mark a job as mandatory. A PR cannot be merged if a job is
5+
# mandatory but not scheduled because of "paths-ignore".
36
on:
4-
#push:
5-
# branches:
6-
# - master
7-
# - 3.8
8-
# - 3.7
9-
# paths-ignore:
10-
# - 'Doc/**'
11-
# - 'Misc/**'
127
pull_request:
138
branches:
149
- master
1510
- 3.8
1611
- 3.7
17-
paths-ignore:
18-
- 'Doc/**'
19-
- 'Misc/**'
2012

2113
jobs:
14+
check_source:
15+
name: 'Check for source changes'
16+
runs-on: ubuntu-latest
17+
outputs:
18+
run_tests: ${{ steps.check.outputs.run_tests }}
19+
steps:
20+
- uses: actions/checkout@v2
21+
- name: Check for source changes
22+
id: check
23+
run: |
24+
if [ -z "GITHUB_BASE_REF" ]; then
25+
echo '::set-output name=run_tests::true'
26+
else
27+
git fetch origin $GITHUB_BASE_REF --depth=1
28+
git diff --name-only origin/$GITHUB_BASE_REF... | grep -qvE '(\.rst$|^Doc|^Misc)' && echo '::set-output name=run_tests::true' || true
29+
fi
2230
build_win32:
2331
name: 'Windows (x86)'
2432
runs-on: windows-latest
33+
needs: check_source
34+
if: needs.check_source.outputs.run_tests == 'true'
2535
steps:
2636
- uses: actions/checkout@v1
2737
- name: Build CPython
@@ -34,6 +44,8 @@ jobs:
3444
build_win_amd64:
3545
name: 'Windows (x64)'
3646
runs-on: windows-latest
47+
needs: check_source
48+
if: needs.check_source.outputs.run_tests == 'true'
3749
steps:
3850
- uses: actions/checkout@v1
3951
- name: Build CPython
@@ -46,6 +58,8 @@ jobs:
4658
build_macos:
4759
name: 'macOS'
4860
runs-on: macos-latest
61+
needs: check_source
62+
if: needs.check_source.outputs.run_tests == 'true'
4963
steps:
5064
- uses: actions/checkout@v1
5165
- name: Configure CPython
@@ -60,6 +74,8 @@ jobs:
6074
build_ubuntu:
6175
name: 'Ubuntu'
6276
runs-on: ubuntu-latest
77+
needs: check_source
78+
if: needs.check_source.outputs.run_tests == 'true'
6379
env:
6480
OPENSSL_VER: 1.1.1f
6581
steps:

0 commit comments

Comments
 (0)