Skip to content

Commit 9638766

Browse files
ci: Separate link checker from checks (#700)
1 parent 0698f40 commit 9638766

2 files changed

Lines changed: 41 additions & 29 deletions

File tree

.github/workflows/check-links.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Check Links
2+
3+
on:
4+
pull_request:
5+
workflow_dispatch:
6+
schedule:
7+
- cron: '41 16 * * 1' # Every Monday at 16:41 UTC (to avoid high load at exact hour values).
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
check-links:
15+
name: Link correctness
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v6
20+
21+
# This will restore the cache for the current commit if it exists, or the most recent lychee
22+
# cache otherwise (including those saved for the main branch). It will also save the cache for
23+
# the current commit if none existed for it, and only if the link check succeeded. We don't
24+
# want to save a cache when the action failed, because the reason for failure might be
25+
# temporary (rate limiting, network issue, etc.), and we always want to retry those links
26+
# everytime this action is run.
27+
- name: Restore lychee cache
28+
uses: actions/cache@v5
29+
with:
30+
path: .lycheecache
31+
key: cache-lychee-${{ github.sha }}
32+
restore-keys: cache-lychee-
33+
34+
- name: Run lychee
35+
uses: lycheeverse/lychee-action@v2
36+
with:
37+
args: --verbose --no-progress --cache --max-cache-age 1d "." --exclude-path "docs/source/_templates/page.html"
38+
fail: true
39+
env:
40+
# This reduces false positives due to rate limits
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/checks.yml

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -88,35 +88,6 @@ jobs:
8888
working-directory: docs
8989
run: uv run make doctest
9090

91-
check-links:
92-
name: Link correctness
93-
runs-on: ubuntu-latest
94-
steps:
95-
- name: Checkout code
96-
uses: actions/checkout@v6
97-
98-
# This will restore the cache for the current commit if it exists, or the most recent lychee
99-
# cache otherwise (including those saved for the main branch). It will also save the cache for
100-
# the current commit if none existed for it, and only if the link check succeeded. We don't
101-
# want to save a cache when the action failed, because the reason for failure might be
102-
# temporary (rate limiting, network issue, etc.), and we always want to retry those links
103-
# everytime this action is run.
104-
- name: Restore lychee cache
105-
uses: actions/cache@v5
106-
with:
107-
path: .lycheecache
108-
key: cache-lychee-${{ github.sha }}
109-
restore-keys: cache-lychee-
110-
111-
- name: Run lychee
112-
uses: lycheeverse/lychee-action@v2
113-
with:
114-
args: --verbose --no-progress --cache --max-cache-age 1d "." --exclude-path "docs/source/_templates/page.html"
115-
fail: true
116-
env:
117-
# This reduces false positives due to rate limits
118-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
119-
12091
code-quality:
12192
name: Code quality (ty and pre-commit hooks)
12293
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)