CI: prune the restored _build/html before building - #616
Merged
Conversation
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>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the GitHub Actions CI and publish workflows to prevent stale HTML assets (e.g., files deleted from the repo) from being carried forward when restoring the cached _build artifact, ensuring previews and the published site reflect deletions reliably.
Changes:
- Add a post-cache-restore cleanup step intended to prune
_build/htmlbefore any subsequent build steps stage assets back into it. - Apply the same pruning logic to both the PR-preview (
ci.yml) and tag-publish (publish.yml) workflows.
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 _build/html prune step after restoring the _build cache to avoid publishing stale static assets in PR previews. |
| .github/workflows/publish.yml | Adds the same _build/html prune step after restoring the _build cache to avoid stale assets reaching GH Pages releases. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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 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. The pinned jupyter-book here matches the one verified in the first rollout repo (>=1.0.4post1,<2.0):--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 notebook and PDF steps, which stage_notebooksand_pdfinto_build/html.Sequencing: this lands ahead of the upcoming
test_pwt.csvdeletion in this repo, so that deletion's eventual publish clears the stale_staticcopy with no forced cache rebuild — the same ordering used in the first rollout repo, where the prune preceded the wave-C2 deletion.Mirrors QuantEcon/lecture-python-advanced.myst#374 — second repo of the nine in the scope of QuantEcon/workspace-lectures#41.
🤖 Generated with Claude Code