Skip to content

Commit fbe5604

Browse files
oschwaldclaude
andcommitted
Add lychee link checker config and CI workflow
Adds a lychee configuration and a Links GitHub Actions workflow so that stale or redirecting links are caught automatically going forward. The checker runs on push, pull request, and weekly to catch external link rot. max_redirects is 0 so links that have moved are surfaced and can be updated to their canonical destination. Part of STF-557. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent c7f5661 commit fbe5604

5 files changed

Lines changed: 122 additions & 0 deletions

File tree

.github/workflows/links.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Links
2+
3+
on:
4+
push:
5+
pull_request:
6+
schedule:
7+
- cron: "0 13 * * 1" # weekly, to catch external link rot without a commit
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
linkChecker:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
18+
with:
19+
persist-credentials: false
20+
21+
- name: Setup mise
22+
uses: jdx/mise-action@6d1e696aa24c1aa1bcc1adea0212707c71ab78a8 # v3.6.1
23+
with:
24+
install: false
25+
26+
# Install only lychee (not the repo's full toolchain) and run the check.
27+
- name: Check links
28+
env:
29+
MISE_AUTO_INSTALL: "false"
30+
run: |
31+
mise install lychee
32+
mise run check-links

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ vendor/
2424
# Claude Code directories
2525
.claude/
2626
.claude_cache/
27+
.lycheecache

lychee.toml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Lychee link checker configuration
2+
# https://lychee.cli.rs/#/usage/config
3+
#
4+
# Run locally with:
5+
# lychee './**/*.md' './src/**/*.php' './composer.json'
6+
7+
# Include URL fragments in checks
8+
include_fragments = true
9+
10+
# Don't allow any redirects, so links that have moved are surfaced and updated
11+
# to their canonical destination.
12+
max_redirects = 0
13+
14+
# Accept these HTTP status codes
15+
# 100-103: Informational responses
16+
# 200-299: Success responses
17+
# 403: Forbidden (some sites use this for rate limiting)
18+
# 429: Too Many Requests
19+
# 500-599: Server errors (temporary issues shouldn't fail CI)
20+
# 999: LinkedIn's custom status code
21+
accept = ["100..=103", "200..=299", "403", "429", "500..=599", "999"]
22+
23+
# Exclude URL patterns from checking (treated as regular expressions)
24+
exclude = [
25+
'^file://',
26+
# Live / auth-gated endpoints that appear as string literals or require login
27+
'^https://geoip\.maxmind\.com',
28+
'^https://geolite\.info',
29+
'^https://minfraud\.maxmind\.com',
30+
'^https://sandbox\.maxmind\.com',
31+
'^https://updates\.maxmind\.com',
32+
'^https://www\.maxmind\.com/en/accounts/',
33+
'https://www\.maxmind\.com/en/account/login',
34+
# Placeholders / local
35+
'^https?://example\.(com|org|net)',
36+
'^http://localhost',
37+
'127\.0\.0\.1',
38+
]
39+
40+
# Exclude file paths from getting checked (treated as regular expressions)
41+
exclude_path = [
42+
'(^|/)node_modules/',
43+
'(^|/)vendor/',
44+
# Generated Hugo docs site committed under docs/public
45+
'(^|/)docs/public/',
46+
'(^|/)\.git/',
47+
# Changelog: historical entries are preserved as-is, not rewritten
48+
'(^|/)CHANGELOG\.md$',
49+
]
50+
51+
# Cache results for 1 day to speed up repeated checks
52+
cache = true
53+
max_cache_age = "1d"
54+
55+
# Skip missing input files instead of erroring
56+
skip_missing = true

mise.lock

Lines changed: 28 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mise.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ disable_backends = [
77

88
[tools]
99
hugo = "latest"
10+
lychee = "latest"
1011

1112
[hooks]
1213
enter = "mise install --quiet"
@@ -22,3 +23,7 @@ run = "hugo --source docs --minify"
2223
[tasks.serve-docs]
2324
description = "Serve the docs site locally with Hugo dev server"
2425
run = "hugo server --source docs"
26+
27+
[tasks.check-links]
28+
description = "Check links with lychee"
29+
run = "lychee --no-progress './**/*.md' './src/**/*.php' './composer.json'"

0 commit comments

Comments
 (0)