Skip to content

Commit 3aee23a

Browse files
committed
feat: add lychee link checker
Add automated link checking using lychee to detect broken links in the built VitePress documentation site. Changes: - Add npm script 'lint:links' to run link checker locally - Create scripts/link-check.sh for local link checking - Add .github/workflows/link-check.yml for CI automation - Remove artefact docs/superpowers directory from past coding sessions that was causing 404 errors The link checker: - Runs against the built docs/.vitepress/dist folder - Excludes local file:// URLs - Accepts 200-299 and 403 status codes - Runs on push, PR, and daily schedule - Creates GitHub issues for broken link reports Security: - All GitHub Actions pinned to specific commit hashes - Uses corepack enable for pnpm (repository standard) - Follows existing workflow patterns from ci.yml Refs: lycheeverse/lychee-action@v2
1 parent e8232ba commit 3aee23a

4 files changed

Lines changed: 70 additions & 187 deletions

File tree

.github/workflows/link-check.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Link Check
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
schedule:
9+
- cron: '0 0 * * *' # Daily at midnight
10+
11+
jobs:
12+
link-checker:
13+
name: Link Checker
14+
runs-on: ubuntu-latest
15+
permissions:
16+
issues: write # Required for creating issues from file
17+
steps:
18+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
19+
with:
20+
persist-credentials: false
21+
22+
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
23+
with:
24+
node-version: 22
25+
26+
- name: Enable pnpm
27+
run: corepack enable
28+
29+
- name: Install dependencies
30+
run: pnpm install --frozen-lockfile
31+
32+
- name: Build docs
33+
run: pnpm run docs:build
34+
35+
- name: Link Checker
36+
id: lychee
37+
uses: lycheeverse/lychee-action@8646ba30535128ac92d33dfc9133794bfdd9b411 # v2
38+
with:
39+
# Check all files in the built site
40+
args: |
41+
docs/.vitepress/dist
42+
--root-dir docs/.vitepress/dist
43+
--include-mail=false
44+
--exclude "^file://"
45+
--accept '200..=299,403'
46+
# Don't fail action on broken links (we'll create an issue instead)
47+
fail: false
48+
# Output format
49+
format: markdown
50+
# Output file path
51+
output: lychee/out.md
52+
53+
- name: Create Issue From File
54+
if: steps.lychee.outputs.exit_code != 0
55+
uses: peter-evans/create-issue-from-file@e8ef132d6df98ed982188e460ebb3b5d4ef3a9cd # v5
56+
with:
57+
title: Link Checker Report
58+
content-filepath: ./lychee/out.md
59+
labels: report, automated issue

docs/superpowers/specs/2026-03-28-bdd-spec-tests-design.md

Lines changed: 0 additions & 186 deletions
This file was deleted.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@
5959
"spec:sync": "./scripts/sync-spec.sh",
6060
"docs:dev": "vitepress dev docs",
6161
"docs:build": "vitepress build docs",
62-
"docs:preview": "vitepress preview docs"
62+
"docs:preview": "vitepress preview docs",
63+
"lint:links": "./scripts/link-check.sh"
6364
},
6465
"dependencies": {
6566
"jsonpath-plus": "^10.3.0",

scripts/link-check.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
set -e
3+
4+
echo "Running lychee link check on dist folder..."
5+
lychee docs/.vitepress/dist \
6+
--root-dir docs/.vitepress/dist \
7+
--include-mail=false \
8+
--exclude "^file://" \
9+
--accept '200..=299,403'

0 commit comments

Comments
 (0)