Skip to content

Pin the link checker to v1 and declare known false positives (#813) #11

Pin the link checker to v1 and declare known false positives (#813)

Pin the link checker to v1 and declare known false positives (#813) #11

# A dataset read that points at the wrong host fails in the reader's notebook,
# not in CI. The data-audit dashboard that would catch it lives in
# QuantEcon/data-lectures, runs on that repo's pushes and a weekly cron, and
# never on a pull request here — so its detection lag is up to seven days.
# This is the only check that fires at the moment of the change.
#
# See QuantEcon/data-lectures PLAN.md, repoint rule 6.
name: Data URL guard
on:
pull_request:
push:
branches: [main]
jobs:
data-url-guard:
runs-on: ubuntu-latest
# This job greps a checkout and writes nothing. The repo default is
# `write`, so without this it would receive a token that can also approve
# pull request reviews.
permissions:
contents: read
steps:
- uses: actions/checkout@v7
- name: No data-lectures read on the LFS media host
run: |
# media.githubusercontent.com is the LFS *media* endpoint and routes
# per path: it serves a file only where that path is LFS-tracked in
# the repo the URL names, and 404s otherwise. Everything data-lectures
# publishes is plain git, so this host never resolves for it — and a
# mechanical org/repo swap that preserves the host breaks every read.
#
# grep -r walks lectures/_static/**/*.ipynb, which the data-lectures
# audit deliberately does not scan and this repo's build never
# executes (lectures/_config.yml, exclude_patterns).
if grep -rnF 'media.githubusercontent.com/media/QuantEcon/data-lectures' lectures/; then
echo "::error::Read data-lectures over raw.githubusercontent.com (or the github.com/.../raw/ redirect), never media.githubusercontent.com — that host is LFS-only and 404s every file data-lectures publishes."
exit 1
fi
echo "OK — no data-lectures read on the media host."