CI: prune the restored _build/html before building - #374
Merged
Conversation
Both ci.yml and publish.yml restore the cached _build and build over it. Sphinx never removes assets deleted from source, so deletions keep being served — in CI previews immediately, on the live site until a clean weekly rebuild happens to intervene. Add jb clean . --html immediately after the cache restore in both workflows. It removes exactly _build/html and nothing else; the .jupyter_cache execution cache is untouched, so the cost is one Sphinx write pass, not a re-execution. Placed before the PDF/notebook steps, which stage their output into _build/html. Ports the prune from QuantEcon/workspace-lectures#41. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
✅ Deploy Preview for lustrous-melomakarona-3ee73e ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the CI and publish GitHub Actions workflows to proactively remove the restored _build/html directory immediately after restoring the cached _build artifact, preventing stale HTML/static assets (from deleted source files) from being carried forward into previews and deployments.
Changes:
- Add a post-cache-restore step to run
jb clean . --htmlin CI before any build steps. - Add the same post-cache-restore
jb clean . --htmlstep in the publish workflow before PDF/notebook staging and HTML build.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| .github/workflows/ci.yml | Adds an early jb clean . --html step after restoring _build to prune stale HTML outputs before rebuilding and staging artifacts. |
| .github/workflows/publish.yml | Adds the same HTML-pruning step after restoring _build to avoid publishing deleted/stale assets on GitHub Pages. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+50
to
+52
| # assets. `jb clean . --html` removes exactly _build/html, leaving | ||
| # .jupyter_cache (the expensive execution cache), _build/latex and | ||
| # _build/jupyter untouched. Must run BEFORE the PDF/notebook steps below, |
Comment on lines
+68
to
+70
| # assets. `jb clean . --html` removes exactly _build/html, leaving | ||
| # .jupyter_cache (the expensive execution cache), _build/latex and | ||
| # _build/jupyter untouched. Must run BEFORE the PDF/notebook steps below, |
Contributor
mmcky
added a commit
that referenced
this pull request
Aug 18, 2026
All three now serve from data-lectures: the repoint merged in #375 and published in publish-2026aug18, whose notebooks and the .notebooks mirror both carry the new URLs (verified by basename sweep — one data-lectures read per notebook, zero refs/heads or loadmat residue). fred_data.csv was the live runtime-fetch case, which is why deletion waited for the publish. Deletion-time re-derivation, 2026-08-18: a fresh authenticated Trees sweep over all 278 org repos (278 covered, 0 skipped) finds no other reader of these paths — every other holder of these basenames owns its own copy (lecture-dp / lecture-dp.monorepo / 2026-tom-course for the ACS file; lecture-tools-techniques / lecture-mapping / python-lecture-sandpit.myst for the .mat, with tools-techniques reading its own copy, tracked in QuantEcon/lecture-tools-techniques#11). match_transport's lecture_specific directory empties with this change; risk_aversion keeps its three figure PNGs. The published site keeps serving the two _static copies until the next cache rebuild plus publish, per the settle policy — the re-audit booked on QuantEcon/workspace-lectures#40 verifies that; CI previews stop serving them immediately now that the prune (#374) is in. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
mmcky
added a commit
to QuantEcon/lecture-python-programming
that referenced
this pull request
Aug 18, 2026
Mirrors QuantEcon/lecture-python-advanced.myst#374 — second repo of the nine in QuantEcon/workspace-lectures#41's scope. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Both
ci.ymlandpublish.ymlrestore the cached_buildartifact and build over it. Sphinx copieshtml_static_pathinto_build/html/_staticbut never prunes assets that have since been removed from source, so a file deleted from this repo keeps being published — in CI previews immediately, and on the live site until a clean weekly cache rebuild happens to intervene. This made deletion verification unreliable during the Track C migration: a reviewer looking at a preview cannot tell whether a deletion took effect.This adds one step to both workflows, immediately after the cache restore and before the first build:
jb clean . --html. Verified against the pinned jupyter-book 1.0.4.post1:--htmlremoves exactly_build/htmland nothing else —_build/.jupyter_cache,_build/latexand_build/jupyterare untouched, so the expensive notebook execution stays cached and the cost is one Sphinx write pass. Placement is load-bearing: the step must run before the PDF and notebook steps, which stage_pdfand_notebooksinto_build/html.No repo in the family has ever run
jb cleanin CI, so this PR's own CI run is the test: it should rebuild all pages from the pruned tree and come out green with a working Netlify preview.Ports the prune from QuantEcon/workspace-lectures#41 — first repo of the nine in that issue's scope.
🤖 Generated with Claude Code