Commit 8dd1c0a
Harden linkcheck.yml, declare known false positives, and pin the action to v1 (#592)
* Harden linkcheck.yml, declare known false positives, pin to v1
Closes #566.
Hardening, as filed
-------------------
The three improvements from #566, already proven in lecture-python-intro
#783:
- `contents: read` in permissions. The block only granted `issues: write`,
and because `permissions:` resets every unlisted scope to none, the
`gh api .../releases/latest` call was running with `contents: none`.
- `set -euo pipefail` and single-asset selection. The old jq emitted one
line per matching asset with nothing to stop an empty or multi-line
result flowing into curl; it now selects the first match and fails with
a clear message when there is none.
- `curl -fsSL` rather than `-sL`, so an HTTP error page is a download
failure rather than a cryptic tar extraction error.
Verified the new jq against this repo's current latest release: it
returns the publish-2026aug03 tarball, same URL as the old form.
Known false positives
---------------------
action-link-checker v1.1.0 adds an `ignore-patterns` input
(QuantEcon/action-link-checker#2, shipped in #3 there). This declares the
same exemptions the repo already keeps in `lectures/_config.yml` under
`linkcheck_ignore`, which Sphinx's built-in checker honours but this
checker never sees -- it scans built HTML, not the Sphinx config. The
regex syntax is identical, so the entries move across unchanged.
FRED is the one that mattered: it throttles datacenter IP ranges, so it
times out from a runner while returning 200 in under half a second from
a normal network. Seventeen duplicate issues were filed for those links
between April and July.
Checked the patterns against the actual published HTML from the current
release, using the shipped v1.1.0 code rather than a reimplementation:
across 33 files and 955 external anchors, 7 anchors match, 6 distinct
URLs, and no FRED link remains checked. The other 948 are unaffected.
Pinning
-------
Moves from `@main` to `@v1`. #566 recorded the decision to stay on
`@main` on the grounds that it is a first-party action, and that holds,
but v1.1.0 shipped a default-on behaviour change (a recurring finding now
refreshes one issue instead of opening a new one weekly) which reached
this repo the moment it merged. `@v1` still takes patches and features
automatically; it just means a future change of that kind is something we
adopt rather than receive.
The other three consumers -- lecture-python-intro,
lecture-python-advanced.myst and continuous_time_mcs -- should move to
`@v1` too, so the series does not end up split across pinning schemes.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* Note that Sphinx anchors these patterns and this checker does not
Copilot review of #592. The comment said the entries move across
"unchanged" because the regex syntax matches, which glossed over a real
difference: Sphinx's linkcheck_ignore is applied with re.match, anchored
at the start of the URL, while action-link-checker applies its
ignore-patterns with re.search.
A pattern copied from _config.yml can therefore match more here than it
does there, never less. It makes no difference to the nine current
entries -- each begins with https://, so matching mid-URL would need a
URL with another URL embedded in it -- but a future maintainer adding a
bare domain would get an entry that this checker honours and Sphinx
silently ignores.
Comment text only; the patterns and the behaviour are unchanged.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent 1bb37dd commit 8dd1c0a
1 file changed
Lines changed: 29 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| 21 | + | |
20 | 22 | | |
21 | | - | |
22 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
23 | 29 | | |
24 | 30 | | |
| 31 | + | |
25 | 32 | | |
26 | | - | |
| 33 | + | |
27 | 34 | | |
28 | | - | |
| 35 | + | |
29 | 36 | | |
30 | 37 | | |
31 | 38 | | |
32 | 39 | | |
33 | 40 | | |
34 | 41 | | |
35 | | - | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
0 commit comments