Skip to content

Commit 7e6f0e0

Browse files
oschwaldclaude
andcommitted
Add lychee link checker config and CI workflow
Part of STF-557. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent fc59ea6 commit 7e6f0e0

4 files changed

Lines changed: 104 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: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,5 @@ MANIFEST
7474

7575
# Claude Code
7676
.claude
77+
78+
.lycheecache

lychee.toml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Lychee link checker configuration
2+
# https://lychee.cli.rs/#/usage/config
3+
#
4+
# Run locally with:
5+
# lychee './**/*.md' './**/*.rst' './src/minfraud/**/*.py' './pyproject.toml'
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 can be
11+
# updated 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+
# GitHub blob URLs with line-number fragments (not parseable as page anchors)
26+
'^https://github\.com/[^/]+/[^/]+/blob/[0-9a-fA-F]+/.+#L\d+$',
27+
# Live / auth-gated MaxMind endpoints: appear as code string literals or
28+
# require login, so they can't be verified by an anonymous request.
29+
'^https://geoip\.maxmind\.com',
30+
'^https://geolite\.info',
31+
'^https://minfraud\.maxmind\.com',
32+
'^https://sandbox\.maxmind\.com',
33+
'^https://updates\.maxmind\.com',
34+
'^https://www\.maxmind\.com/en/accounts/',
35+
'^https://www\.maxmind\.com/en/account/login',
36+
# Local / placeholder URLs (e.g. the proxy example in docstrings)
37+
'^file://',
38+
'^https?://example\.(com|org|net)',
39+
'^http://localhost',
40+
'127\.0\.0\.1',
41+
]
42+
43+
# Exclude file paths from getting checked (regular expressions, matched against
44+
# the path relative to the working directory). Patterns are segment-anchored
45+
# with (^|/) so short names like "build" don't match unintended paths.
46+
exclude_path = [
47+
'(^|/)node_modules/',
48+
'(^|/)\.venv/',
49+
'(^|/)venv/',
50+
'(^|/)build/',
51+
'(^|/)dist/',
52+
'(^|/)\.eggs/',
53+
'(^|/)[^/]*\.egg-info/',
54+
'(^|/)docs/_build/',
55+
# Changelog: historical entries are preserved as-is, not rewritten
56+
'(^|/)HISTORY\.rst$',
57+
]
58+
59+
# Cache results for 1 day to speed up repeated checks
60+
cache = true
61+
max_cache_age = "1d"
62+
63+
# Skip missing input files instead of erroring
64+
skip_missing = true

mise.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[tools]
2+
lychee = "0.23.0"
3+
4+
[tasks.check-links]
5+
description = "Check links with lychee"
6+
run = "lychee --no-progress './**/*.md' './**/*.rst' './src/minfraud/**/*.py' './pyproject.toml'"

0 commit comments

Comments
 (0)