Repository navigation
Fix linkcheck false positives from the gh-pages migration - #215
Conversation
The artifact migration (#213) switched linkcheck from checking out the gh-pages branch to a wget mirror of the live site. That mirror fetches only HTML (--accept html), so lychee reported every local asset (_static/*, _images/*) as "file not found"; the deploy also dropped 200 from --accept, so every working link (200) was flagged. Net result was issue #214: 522 "errors" that were essentially all false positives (0 real broken links, 0 timeouts). Switch to checking the published HTML release asset instead — a permanent tarball of the full site (HTML + assets), per QuantEcon/meta#282 lesson 2 and matching lecture-python-programming's linkcheck. Restore --accept 200,403,503 and add --root-dir so root-relative links (/_notebooks/*.ipynb, /_pdf/book.pdf) resolve against the site root. The release-asset input also removes the dependency on the live site being reachable at check time. See QuantEcon/meta#282 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
✅ Deploy Preview for adorable-cucurucho-69162b ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for sparkly-moxie-de1f0e ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull request overview
This pull request updates the repository’s GitHub Actions link-check workflow to avoid false positives introduced by the recent GitHub Pages deployment migration, by checking links against the published site HTML release asset rather than a partial wget mirror of the live site.
Changes:
- Download and extract the latest published HTML release tarball into
_site(instead of mirroring the live site withwget). - Restore
--accept 200,403,503so successful links (200) are not incorrectly flagged as failures. - Add
--root-dirso root-relative links (e.g./_pdf/...,/_notebooks/...) resolve correctly against the extracted site tree.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The recursive glob also scanned _site/_static/webpack-macros.html, a Sphinx
theme partial containing raw Jinja (`{{ pathto(...) }}`) that lychee misread
as ~15 broken local links. Restrict to top-level '_site/*.html' — matching the
old checkout's '*.html' scope — so only real lecture pages are checked.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Validated on the PR branch via
The 6 remaining are real dangling links in the built site, not config artifacts: the auto-generated utility pages ( |
Under `set -eo pipefail`, a transient `gh api` failure aborted the fetch step before the empty-input guard ran, so no 'release asset missing' report was created. Add `|| true` (and silence stderr) so the guard still fires. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Under `set -eo pipefail`, a transient `gh api` failure aborted the fetch step before the empty-input guard ran, so no 'release asset missing' report was created. Add `|| true` (and silence stderr) so the guard still fires. Mirrors QuantEcon/continuous_time_mcs#215 (Copilot review follow-up). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
* Fix linkcheck false positives (release-asset input, accept 200) lecture-dp's link checker mirrored the live site with `wget --accept html`, which fetches only HTML — so lychee reported every local asset (_static/*, _images/*) as "file not found" — and used `--accept 403,503`, which drops 200 so every working link was flagged. Check the published HTML release asset instead — a permanent tarball of the full site (HTML + assets), per QuantEcon/meta#282 lesson 2 and matching lecture-python-programming. Restore `--accept 200,403,503`, add `--root-dir` for root-relative links, and scan only top-level `_site/*.html` so the Sphinx theme partials under _static/ (raw Jinja, not real links) are skipped. Mirrors the fix in QuantEcon/continuous_time_mcs#215. See QuantEcon/meta#282 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * Make release-asset fetch non-fatal Under `set -eo pipefail`, a transient `gh api` failure aborted the fetch step before the empty-input guard ran, so no 'release asset missing' report was created. Add `|| true` (and silence stderr) so the guard still fires. Mirrors QuantEcon/continuous_time_mcs#215 (Copilot review follow-up). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * Harden release-asset extract against partial downloads (Copilot review) A failed or truncated `curl | tar` was swallowed by `|| true`, potentially leaving a partial _site tree where count > 0 — so lychee would run against an incomplete site and re-introduce 'file not found' false positives. Use `curl -f` and an `if !` guard that clears _site on failure, so a bad download is treated as 'no usable asset' and reported via the guard. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
What
Fixes the noisy link-check reports (e.g. #214) introduced by the gh-pages migration (#213). Follow-up to that PR.
The regression
Migration PR #213 switched the link checker from checking out the
gh-pagesbranch to awgetmirror of the live site. Two problems came from that:wget --accept htmlfetches only HTML — none of the_static/*CSS/JS,_images/*,_pdf/, or_notebooks/assets. lychee then checked those relative links as local files and reported them all as "Cannot find file". (The old gh-pages checkout had the whole site, assets included, so they resolved.)--accept 403,503dropped200— so every working link, including the site's own pages, was flagged as "Rejected status code: 200".Net effect in #214: 522 "errors" out of 1000, essentially all false positives — 0 real broken links, 0 timeouts. For comparison, the last pre-migration run (#212) reported 37 errors out of 1109.
The fix
Check links against the published HTML release asset — a permanent
.tar.gzof the full site (HTML plus all assets) that the publish workflow now attaches to eachpublish-*release. This is the approach recommended in QuantEcon/meta#282 (lesson 2) and already used bylecture-python-programming.continuous-time-mcs-html-*.tar.gzfrom the latest release into_site(replaces thewgetmirror). No dependency on the live site being reachable at check time.--accept 200,403,503so working links pass.--root-dirso root-relative links (/_notebooks/*.ipynb,/_pdf/book.pdf) resolve against the extracted site root.peter-evans/create-issue-from-filereporting.After this, a run should surface only genuine link issues (on the order of #212's ~37), not the ~485 false positives.
Related
lecture-dpuses the samewget-mirror linkcheck pattern and has the same latent issue — worth the same fix in a separate PR.🤖 Generated with Claude Code