Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .config/lychee.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Lychee link checker configuration
# Based on PRQL's proven patterns: https://github.com/PRQL/prql

# Network resilience - handles transient failures
max_retries = 5
timeout = 20
max_redirects = 5

# Accepted HTTP status codes
accept = [200, 206, 429]

# Caching to reduce rate limiting and improve performance
cache = true
max_cache_age = "1d"

# Exclude sites that block GitHub Actions or have reliability issues
exclude = [
# Social media (blocks GitHub Actions)
"~twitter\\.com",
"~x\\.com",

# Sites with reliability issues in CI
"~stackoverflow\\.com",
"~npmjs\\.com",

# Package registries (frequently return 429 or block CI)
"~crates\\.io",
"~docs\\.rs",
"~img\\.shields\\.io",

# Sites already excluded in markdown-link-check
"~opensource\\.org",
"~llm\\.datasette\\.io",
]
45 changes: 45 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,48 @@ jobs:
with:
command: doc
args: --no-deps

check-links:
name: Check links
runs-on: ubuntu-latest
steps:
- name: 📂 Checkout code
uses: actions/checkout@v5

- name: Install lychee
uses: baptiste0928/cargo-install@v3
with:
crate: lychee

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install pre-commit
run: pip install pre-commit

- name: Cache lychee results
uses: actions/cache@v4
with:
path: .lycheecache
key: lychee-${{ github.sha }}
restore-keys: lychee-

- name: Get modified markdown files
if: github.event_name == 'pull_request'
id: changed-files
uses: tj-actions/changed-files@v47
with:
files: |
**/*.md

- name: Link checker (modified files - PRs)
if: github.event_name == 'pull_request' && steps.changed-files.outputs.any_modified == 'true'
run: pre-commit run lychee --files ${{ steps.changed-files.outputs.all_changed_files }}
continue-on-error: true

- name: Link checker (all files - main branch)
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: pre-commit run lychee --all-files
continue-on-error: true
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
/target

# Lychee link checker cache
.lycheecache
22 changes: 0 additions & 22 deletions .markdown-link-check.json

This file was deleted.

24 changes: 18 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,25 @@ repos:
hooks:
- id: clippy
args: ["--all-targets", "--", "-D", "warnings"]
- repo: https://github.com/tcort/markdown-link-check
rev: v3.14.1
- repo: https://github.com/lycheeverse/lychee
rev: lychee-v0.21.0
hooks:
- id: markdown-link-check
name: markdown-link-check
# Fast PR mode - only check worktrunk domains and local files
- id: lychee
name: lychee (PR mode)
types: [markdown]
args: ["--config", ".markdown-link-check.json"]
args:
- --include=^(https://(github\.com/worktrunk|worktrunk\.dev)|file://)
- --no-progress
# Comprehensive mode - check all links with full config
# Run manually: pre-commit run --hook-stage manual lychee-all --all-files
- id: lychee
name: lychee-all (comprehensive)
types: [markdown]
stages: [manual]
args:
- --config=.config/lychee.toml
- --no-progress
- repo: local
hooks:
- id: no-dbg
Expand All @@ -49,5 +61,5 @@ repos:

ci:
# Currently network access isn't supported in the CI product.
skip: [fmt, markdown-link-check]
skip: [fmt, lychee (PR mode)]
autoupdate_commit_msg: "chore: pre-commit autoupdate"
Loading