@@ -54,13 +54,45 @@ jobs:
5454 run : |
5555 python -m pip install --upgrade nox virtualenv
5656
57+ - name : Restore linkcheck baseline
58+ if : >-
59+ ${{ matrix.noxenv == 'linkcheck' &&
60+ (github.event_name == 'pull_request' || github.event_name == 'merge_group') }}
61+ uses : actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
62+ with :
63+ path : build/linkcheck-baseline.json
64+ key : linkcheck-${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha }}
65+ restore-keys : |
66+ linkcheck-
67+
5768 - name : Nox ${{ matrix.noxenv }}
5869 env :
5970 # Authenticate github.com requests during linkcheck to avoid rate limits.
6071 GITHUB_TOKEN : ${{ matrix.noxenv == 'linkcheck' && github.token || '' }}
72+ LINKCHECK_BASELINE : >-
73+ ${{ matrix.noxenv == 'linkcheck' &&
74+ (github.event_name == 'pull_request' || github.event_name == 'merge_group') &&
75+ 'build/linkcheck-baseline.json' || '' }}
6176 run : |
6277 python -m nox -s ${{ matrix.noxenv }}
6378
79+ - name : Prepare linkcheck baseline
80+ if : >-
81+ ${{ always() && matrix.noxenv == 'linkcheck' &&
82+ github.event_name == 'push' && github.ref == 'refs/heads/main' &&
83+ hashFiles('build/output.json') != '' }}
84+ run : cp build/output.json build/linkcheck-baseline.json
85+
86+ - name : Save linkcheck baseline
87+ if : >-
88+ ${{ always() && matrix.noxenv == 'linkcheck' &&
89+ github.event_name == 'push' && github.ref == 'refs/heads/main' &&
90+ hashFiles('build/linkcheck-baseline.json') != '' }}
91+ uses : actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
92+ with :
93+ path : build/linkcheck-baseline.json
94+ key : linkcheck-${{ github.sha }}
95+
6496
6597 check :
6698 # This job does nothing and is only used for the branch protection
0 commit comments