@@ -54,13 +54,55 @@ jobs:
5454 run : |
5555 python -m pip install --upgrade nox virtualenv
5656
57+ - name : Restore linkcheck baseline
58+ id : restore-linkcheck-baseline
59+ if : matrix.noxenv == 'linkcheck'
60+ uses : actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
61+ with :
62+ path : .linkcheck-cache/output.json
63+ key : linkcheck-output-${{ github.event.repository.default_branch }}-${{ github.sha }}
64+ restore-keys : |
65+ linkcheck-output-${{ github.event.repository.default_branch }}-
66+
5767 - name : Nox ${{ matrix.noxenv }}
5868 env :
5969 # Authenticate github.com requests during linkcheck to avoid rate limits.
6070 GITHUB_TOKEN : ${{ matrix.noxenv == 'linkcheck' && github.token || '' }}
71+ LINKCHECK_BASELINE_JSON : >-
72+ ${{
73+ matrix.noxenv == 'linkcheck' &&
74+ github.event_name == 'pull_request' &&
75+ '.linkcheck-cache/output.json' ||
76+ ''
77+ }}
6178 run : |
6279 python -m nox -s ${{ matrix.noxenv }}
6380
81+ - name : Store linkcheck baseline
82+ if : >-
83+ ${{
84+ matrix.noxenv == 'linkcheck' &&
85+ github.event_name != 'pull_request' &&
86+ github.ref_name == github.event.repository.default_branch &&
87+ hashFiles('build/output.json') != ''
88+ }}
89+ run : |
90+ mkdir -p .linkcheck-cache
91+ cp build/output.json .linkcheck-cache/output.json
92+
93+ - name : Save linkcheck baseline
94+ if : >-
95+ ${{
96+ matrix.noxenv == 'linkcheck' &&
97+ github.event_name != 'pull_request' &&
98+ github.ref_name == github.event.repository.default_branch &&
99+ hashFiles('.linkcheck-cache/output.json') != ''
100+ }}
101+ uses : actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
102+ with :
103+ path : .linkcheck-cache/output.json
104+ key : linkcheck-output-${{ github.event.repository.default_branch }}-${{ github.sha }}
105+
64106
65107 check :
66108 # This job does nothing and is only used for the branch protection
0 commit comments