Link Checker #211
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Link Checker | |
| # Link checking scans a fully built site (dist/**/*.html), so it runs the same | |
| # heavy build.yml pipeline — clone the archive, read ~16k metadata files, run | |
| # vite-ssg. That is far too slow for a per-PR gate (it was taking ~1h per PR), | |
| # so — like build.yml — it does NOT run on pull_request. It runs post-merge on | |
| # main, on demand, and weekly to catch external link-rot between merges. | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| schedule: | |
| - cron: '0 6 * * 1' | |
| permissions: | |
| contents: read | |
| jobs: | |
| link_checker: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| # Same build-time metadata the main build needs — see build.yml. | |
| - name: Checkout archive-private (metadata only) | |
| id: meta | |
| continue-on-error: true | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: fontist/fontist-archive-private | |
| token: ${{ secrets.FONTIST_CI_PAT_TOKEN }} | |
| path: vendor/archive-private | |
| filter: blob:none | |
| sparse-checkout: | | |
| fonts.json | |
| metadata | |
| sparse-checkout-cone-mode: false | |
| - name: Setup Node | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 24 | |
| cache: 'npm' | |
| cache-dependency-path: package-lock.json | |
| - name: Install dependencies | |
| run: npm ci | |
| # Same caches as build.yml — keyed on the upstream commit, so a hit only | |
| # happens when the source is unchanged. See build.yml for rationale. | |
| - name: Resolve upstream commits | |
| id: upstream | |
| run: | | |
| echo "formulas=$(git ls-remote https://github.com/fontist/formulas.git v5 | cut -f1)" >> "$GITHUB_OUTPUT" | |
| echo "essenfont=$(git ls-remote https://github.com/essenfont/essenfont.github.io.git HEAD | cut -f1)" >> "$GITHUB_OUTPUT" | |
| - name: Cache formulas data | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| public/formulas-data.json | |
| public/stats.json | |
| key: formulas-data-${{ steps.upstream.outputs.formulas }} | |
| - name: Cache Essenfont woff2 | |
| uses: actions/cache@v4 | |
| with: | |
| path: public/fonts | |
| key: essenfont-${{ steps.upstream.outputs.essenfont }} | |
| - name: Build | |
| env: | |
| ARCHIVE_META_PATH: ${{ steps.meta.outcome == 'success' && 'vendor/archive-private' || '' }} | |
| run: npm run build | |
| - name: Restore lychee cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: .lycheecache | |
| key: cache-lychee-${{ github.sha }} | |
| restore-keys: cache-lychee- | |
| - name: Check if site was built | |
| run: | | |
| if [ ! -d "dist" ]; then | |
| echo "Error: dist directory not created" | |
| exit 1 | |
| fi | |
| echo "Site built successfully" | |
| ls -la dist/ | |
| - name: Link Checker | |
| uses: lycheeverse/lychee-action@v2 | |
| with: | |
| args: >- | |
| --verbose | |
| --no-progress | |
| --config lychee.toml | |
| --root-dir ${{ github.workspace }}/dist | |
| 'dist/**/*.html' | |
| fail: true | |
| output: link-check-results.md | |
| format: markdown | |
| - name: Upload link check results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: link-check-results | |
| path: link-check-results.md | |
| retention-days: 30 |