Files
sweet/.github/workflows/ci.yml
T
Bartek IwańczukandClaude Opus 4.6 2c94a1da2e ci: add link checker to CI (#3707)
## Summary
- Rewrite `tools/check_links.ts` to be more robust (inspired by
denoland/docs' `better_link_checker.ts`)
- Add `deno task check:links` to `deno.json`
- Wire it into CI as a new step (Ubuntu + v2.x only, after `build-www`)
- Add missing `docs/latest/examples/index.md` to fix broken
`/docs/examples` link
- Crawl up to 10 pages concurrently for faster link checking

## What the link checker does
1. Builds the www site with Vite
2. Launches a production server
3. Crawls all internal links starting from the root (10 pages
concurrently)
4. Reports broken links (4xx/5xx) with referrer info
5. Detects empty `href` attributes
6. Prints a summary at the end instead of throwing on first failure

Improvements over the old `check_links.ts`:
- Doesn't throw on first 404 — collects all failures and reports at the
end
- Detects empty hrefs
- Skips non-HTML content, fragment-only links, external links, and
common static file extensions
- Shows referrer for each broken link so you know where to fix it

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 13:49:17 +00:00

81 lines
2.0 KiB
YAML

name: ci
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
pr-title:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Validate PR title
env:
TITLE: ${{ github.event.pull_request.title }}
run: |
if ! echo "$TITLE" | grep -qP '^(feat|fix|test|chore|ci):'; then
echo "::error::PR title must start with feat:, fix:, test:, chore:, or ci:"
exit 1
fi
test:
runs-on: ${{ matrix.os }}
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
deno: ["v2.x", "canary"]
os: [macOS-latest, windows-latest, ubuntu-latest]
include:
- os: ubuntu-latest
cache_path: ~/.cache/deno/
- os: macos-latest
cache_path: ~/Library/Caches/deno/
- os: windows-latest
cache_path: ~\AppData\Local\deno\
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup Deno
uses: denoland/setup-deno@v2
with:
cache: true
deno-version: ${{ matrix.deno }}
- name: Install dependencies
run: deno install
- name: Verify formatting
if: startsWith(matrix.os, 'ubuntu') && matrix.deno == 'v2.x'
run: deno fmt --check
- name: Run linter
if: startsWith(matrix.os, 'ubuntu') && matrix.deno == 'v2.x'
run: deno lint
- name: Spell-check
if: startsWith(matrix.os, 'ubuntu') && matrix.deno == 'v2.x'
uses: crate-ci/typos@master
- name: Type check project
run: deno task check:types
- name: Run tests
run: deno task test
- name: Check docs
run: deno task check:docs
- name: Build fresh.deno.dev
if: startsWith(matrix.os, 'ubuntu') && matrix.deno == 'v2.x'
run: deno task build-www
- name: Check links
if: startsWith(matrix.os, 'ubuntu') && matrix.deno == 'v2.x'
run: deno task check:links