@@ -54,13 +54,39 @@ jobs:
5454 run : |
5555 python -m pip install --upgrade nox virtualenv
5656
57+ - name : Restore linkcheck baseline
58+ if : matrix.noxenv == 'linkcheck' && github.event_name == 'pull_request'
59+ uses : actions/cache/restore@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
60+ with :
61+ path : .linkcheck-baseline/output.json
62+ key : linkcheck-output-${{ github.event.pull_request.base.sha }}
63+ restore-keys : |
64+ linkcheck-output-
65+
5766 - name : Nox ${{ matrix.noxenv }}
5867 env :
5968 # Authenticate github.com requests during linkcheck to avoid rate limits.
6069 GITHUB_TOKEN : ${{ matrix.noxenv == 'linkcheck' && github.token || '' }}
70+ # Ignore links that were already reported by the baseline linkcheck run.
71+ LINKCHECK_IGNORE_FILE : >-
72+ ${{ matrix.noxenv == 'linkcheck' && '.linkcheck-baseline/output.json' || '' }}
6173 run : |
6274 python -m nox -s ${{ matrix.noxenv }}
6375
76+ - name : Prepare linkcheck baseline
77+ if : matrix.noxenv == 'linkcheck' && github.event_name == 'push' && github.ref == 'refs/heads/main'
78+ run : |
79+ mkdir -p .linkcheck-baseline
80+ cp build/output.json .linkcheck-baseline/output.json
81+
82+ - name : Save linkcheck baseline
83+ if : matrix.noxenv == 'linkcheck' && github.event_name == 'push' && github.ref == 'refs/heads/main'
84+ continue-on-error : true
85+ uses : actions/cache/save@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
86+ with :
87+ path : .linkcheck-baseline/output.json
88+ key : linkcheck-output-${{ github.sha }}
89+
6490
6591 check :
6692 # This job does nothing and is only used for the branch protection
0 commit comments