@@ -0,0 +1,49 @@
1+# A dataset read that points at the wrong host fails in the reader's notebook,
2+# not in CI. The data-audit dashboard that would catch it lives in
3+# QuantEcon/data-lectures, runs on that repo's pushes and a weekly cron, and
4+# never on a pull request here — so its detection lag is up to seven days.
5+# This is the only check that fires at the moment of the change.
6+#
7+# It is also the only check here that fires on a PROSE edit. `ci.yml` executes
8+# the book, but jupyter-cache hashes code cells only and restores a warm shared
9+# cache, so a markdown link or a {download} role that points at a dead URL
10+# cache-hits and goes green. Do not read a green `ci.yml` as evidence that a
11+# prose link resolves.
12+#
13+# See QuantEcon/data-lectures PLAN.md, repoint rule 6.
14+15+name: Data URL guard
16+17+on:
18+pull_request:
19+push:
20+branches: [main]
21+22+jobs:
23+data-url-guard:
24+runs-on: ubuntu-latest
25+# This job greps a checkout and writes nothing. The repo default is
26+# `write`, so without this it would receive a token that can also approve
27+# pull request reviews.
28+permissions:
29+contents: read
30+steps:
31+ - uses: actions/checkout@v7
32+ - name: No data-lectures read on the LFS media host
33+run: |
34+ # media.githubusercontent.com is the LFS *media* endpoint and routes
35+ # per path: it serves a file only where that path is LFS-tracked in
36+ # the repo the URL names, and 404s otherwise. Everything data-lectures
37+ # publishes is plain git, so this host never resolves for it — and a
38+ # mechanical org/repo swap that preserves the host breaks every read.
39+ #
40+ # grep -r walks lectures/_static/** too. Nothing under _static is
41+ # executed by this repo's build (it is an asset path, and
42+ # `only_build_toc_files: true` builds exactly _toc.yml), and the
43+ # data-lectures audit excludes _static by design — so a bad URL in a
44+ # vendored notebook or script there is invisible everywhere else.
45+ if grep -rnF 'media.githubusercontent.com/media/QuantEcon/data-lectures' lectures/; then
46+ 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."
47+ exit 1
48+ fi
49+ echo "OK — no data-lectures read on the media host."