Skip to content

Commit e7e9478

Browse files
mmckyclaude
andcommitted
CI: guard against reading data-lectures over the LFS media host
A dataset URL on the wrong host fails in the reader's notebook, not in CI. media.githubusercontent.com is the LFS *media* endpoint and routes per path, serving a file only where that path is LFS-tracked in the repo the URL names. Everything data-lectures publishes is plain git, so that host never resolves for it — and the datasets folded in from high_dim_data are read from it today, which means a mechanical org/repo swap that preserves the host breaks every one of them. Nothing in this repo would catch that. The data-audit dashboard that does lives in QuantEcon/data-lectures and never runs on a pull request here — its detection lag is up to seven days. This runs pre-merge, in the repo being changed, and `grep -r` also walks lectures/_static/**/*.ipynb, which the audit deliberately does not scan and this repo's build never executes. Matches zero lines today (verified: exit 1), so it goes green on merge and is armed before the fold rather than alongside it. Gate 2 of QuantEcon/workspace-lectures#23 step 3. See QuantEcon/data-lectures PLAN.md, repoint rule 6. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 7694e3e commit e7e9478

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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+
# See QuantEcon/data-lectures PLAN.md, repoint rule 6.
8+
9+
name: Data URL guard
10+
11+
on:
12+
pull_request:
13+
push:
14+
branches: [main]
15+
16+
jobs:
17+
data-url-guard:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v7
21+
- name: No data-lectures read on the LFS media host
22+
run: |
23+
# media.githubusercontent.com is the LFS *media* endpoint and routes
24+
# per path: it serves a file only where that path is LFS-tracked in
25+
# the repo the URL names, and 404s otherwise. Everything data-lectures
26+
# publishes is plain git, so this host never resolves for it — and a
27+
# mechanical org/repo swap that preserves the host breaks every read.
28+
#
29+
# grep -r walks lectures/_static/**/*.ipynb, which the data-lectures
30+
# audit deliberately does not scan and this repo's build never
31+
# executes (lectures/_config.yml, exclude_patterns).
32+
if grep -rnF 'media.githubusercontent.com/media/QuantEcon/data-lectures' lectures/; then
33+
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."
34+
exit 1
35+
fi
36+
echo "OK — no data-lectures read on the media host."

0 commit comments

Comments
 (0)