Skip to content

Commit e2c1de0

Browse files
ltorres6claude
andcommitted
Add link-check GitHub Action
Runs on push and pull_request to catch broken links before merge: - `mkdocs build --strict` fails on broken internal links and missing nav targets - lychee checks external http/https links in docs and mkdocs.yml Auth-gated / bot-blocking hosts (ISMRM proceedings, Slack, Google Docs, LinkedIn) are listed in .lycheeignore so they don't cause unreliable failures. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent f22872f commit e2c1de0

2 files changed

Lines changed: 59 additions & 0 deletions

File tree

.github/workflows/links.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Check links
2+
3+
# Catches broken links before they reach master. Two layers:
4+
# 1. `mkdocs build --strict` fails on broken internal links and missing
5+
# navigation targets.
6+
# 2. lychee checks external (http/https) links in the docs and mkdocs.yml.
7+
# Hosts that require a login or block automated requests are listed in
8+
# .lycheeignore so they don't produce unreliable failures.
9+
10+
on:
11+
push:
12+
pull_request:
13+
workflow_dispatch:
14+
15+
permissions:
16+
contents: read
17+
18+
jobs:
19+
links:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0
26+
27+
- name: Set up Python
28+
uses: actions/setup-python@v5
29+
with:
30+
python-version: '3.x'
31+
32+
- name: Install dependencies
33+
run: |
34+
python -m pip install --upgrade pip
35+
pip install -r requirements.txt
36+
37+
- name: Build site (fails on broken internal links and nav)
38+
run: mkdocs build --strict
39+
40+
- name: Check external links
41+
uses: lycheeverse/lychee-action@v2
42+
with:
43+
args: >-
44+
--no-progress
45+
--scheme http
46+
--scheme https
47+
--accept 200,206,429
48+
--max-retries 2
49+
"docs/**/*.md"
50+
"mkdocs.yml"
51+
"Readme.md"
52+
fail: true
53+
env:
54+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.lycheeignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
cds\.ismrm\.org
2+
slack\.com
3+
docs\.google\.com
4+
linkedin\.com
5+
lnkd\.in

0 commit comments

Comments
 (0)