-
Notifications
You must be signed in to change notification settings - Fork 41
86 lines (74 loc) · 2.47 KB
/
links.yml
File metadata and controls
86 lines (74 loc) · 2.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: Links
on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: "0 6 * * 1" # Weekly on Monday at 06:00 UTC — catches rotted external links
workflow_dispatch: # manual trigger for the external-link sweep
permissions:
contents: read
jobs:
# Blocking: broken internal links are a content bug we can always fix.
# Crawls the built site served locally so directory URLs (/spec/x/) resolve
# to their index.html exactly as in production. External links are skipped.
internal:
name: Internal links
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: 22
cache: npm
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
env:
NODE_ENV: production
- name: Check internal links
run: |
npx astro preview --port 4321 &
up=
for i in $(seq 1 30); do
curl -sf http://localhost:4321/ >/dev/null && { up=1; break; }
sleep 1
done
[ -n "$up" ] || { echo "::error::preview server did not start"; exit 1; }
npx --yes linkinator@6 http://localhost:4321 \
--recurse --skip "^https?://(?!localhost)"
# Non-blocking: external links break for reasons outside our control (IETF /
# W3C / MDN rate-limiting, upstream outages). Runs weekly and on demand so
# rot is visible without holding PRs hostage to a flaky upstream.
external:
name: External links
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v6
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: 22
cache: npm
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
env:
NODE_ENV: production
- name: Check all links (internal + external)
run: |
npx astro preview --port 4321 &
up=
for i in $(seq 1 30); do
curl -sf http://localhost:4321/ >/dev/null && { up=1; break; }
sleep 1
done
[ -n "$up" ] || { echo "::error::preview server did not start"; exit 1; }
npx --yes linkinator@6 http://localhost:4321 \
--config linkinator.config.json