Skip to content

Commit 610e80b

Browse files
authored
Merge pull request #2030 from marxin/ci-cache
Save linkcheck cache always
2 parents 7d59cb3 + 10c76e1 commit 610e80b

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

.github/workflows/ci.yml

+15-5
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,13 @@ jobs:
3535
~/.cargo/bin
3636
key: ${{ runner.os }}-${{ env.MDBOOK_VERSION }}--${{ env.MDBOOK_LINKCHECK2_VERSION }}--${{ env.MDBOOK_TOC_VERSION }}--${{ env.MDBOOK_MERMAID_VERSION }}
3737

38-
- name: Cache linkcheck
39-
uses: actions/cache@v4
38+
- name: Restore cached Linkcheck
39+
if: github.event_name == 'schedule'
40+
id: cache-linkcheck-restore
41+
uses: actions/cache/restore@v4
4042
with:
41-
path: |
42-
~/book/linkcheck
43-
key: ${{ runner.os }}-${{ hashFiles('./book/linkcheck') }}
43+
path: book/linkcheck/cache.json
44+
key: linkcheck--${{ env.MDBOOK_LINKCHECK2_VERSION }}
4445

4546
- name: Install latest nightly Rust toolchain
4647
if: steps.mdbook-cache.outputs.cache-hit != 'true'
@@ -58,6 +59,15 @@ jobs:
5859
5960
- name: Check build
6061
run: ENABLE_LINKCHECK=1 mdbook build
62+
continue-on-error: true
63+
64+
- name: Save cached Linkcheck
65+
id: cache-linkcheck-save
66+
if: github.event_name == 'schedule'
67+
uses: actions/cache/save@v4
68+
with:
69+
path: book/linkcheck/cache.json
70+
key: linkcheck--${{ env.MDBOOK_LINKCHECK2_VERSION }}
6171

6272
- name: Deploy to gh-pages
6373
if: github.event_name == 'push'

book.toml

+3-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ exclude = [
5252
# 500 is returned for HEAD request
5353
"code\\.visualstudio\\.com/docs/editor/tasks",
5454
]
55-
cache-timeout = 86400
55+
# The scheduled CI runs every day and so we need to reuse a part of the cache
56+
# in order to face "Server returned 429 Too Many Requests" errors for github.com.
57+
cache-timeout = 90000
5658
warning-policy = "error"
5759

5860
[output.html.redirect]

0 commit comments

Comments
 (0)