Skip to content

Commit 977be50

Browse files
committed
ci: block PRs only on newly broken links
1 parent c2fe4df commit 977be50

1 file changed

Lines changed: 12 additions & 8 deletions

File tree

‎.github/workflows/test.yml‎

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,17 @@ jobs:
2525
if: ${{ github.repository_owner == 'pypa' || github.event_name != 'schedule' }}
2626
runs-on: ubuntu-latest
2727
timeout-minutes: 20
28-
continue-on-error: >-
29-
${{ fromJSON(matrix.continue-on-error) }}
3028
strategy:
3129
matrix:
3230
noxenv:
3331
- build
34-
continue-on-error:
35-
- false
36-
include:
37-
- noxenv: linkcheck
38-
continue-on-error: >- # Don't block PRs on linkcheck unrelated failures
39-
${{ toJSON(github.event_name == 'pull_request') }}
32+
- linkcheck
4033

4134
steps:
4235
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
4336
with:
4437
persist-credentials: false
38+
fetch-depth: 0 # needed to compare PR links against the base commit
4539

4640
- name: Set up Python
4741
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
@@ -55,12 +49,22 @@ jobs:
5549
python -m pip install --upgrade nox virtualenv
5650
5751
- name: Nox ${{ matrix.noxenv }}
52+
continue-on-error: >-
53+
${{ matrix.noxenv == 'linkcheck' && github.event_name == 'pull_request' }}
5854
env:
5955
# Authenticate github.com requests during linkcheck to avoid rate limits.
6056
GITHUB_TOKEN: ${{ matrix.noxenv == 'linkcheck' && github.token || '' }}
6157
run: |
6258
python -m nox -s ${{ matrix.noxenv }}
6359
60+
- name: Check links introduced by the PR
61+
if: >-
62+
${{ always() && matrix.noxenv == 'linkcheck' && github.event_name == 'pull_request' }}
63+
env:
64+
BASE_SHA: ${{ github.event.pull_request.base.sha }}
65+
run: |
66+
python scripts/check_new_link_failures.py --base "$BASE_SHA" --report build/output.json
67+
6468
6569
check:
6670
# This job does nothing and is only used for the branch protection

0 commit comments

Comments
 (0)