Repository navigation
Description
Summary
Unify the PR deploy-preview mechanism across the Python lecture repos onto the shared composite action quantecon/actions/preview-netlify, pinned at @v0.6.0.
Today the preview step is configured inconsistently: most repos call nwtgck/actions-netlify directly at drifting versions (@v3, @v3.0, @v1.1), two repos deploy a duplicate preview from collab.yml, one repo has no preview at all, and only lecture-python.myst has adopted the shared action.
This is deliberately scoped as a safe first deployment of our shared-action stack: the preview step is build-agnostic (it only consumes _build/html), so a broken migration breaks previews (cosmetic, non-blocking) rather than builds (which would block every PR and publish). The broader migration of each repo onto the full quantecon/actions/* stack (setup-environment, restore-jupyter-cache, build-lectures, publish-gh-pages) is Track 2 and explicitly out of scope here — see Out of scope.
Why now
- Ends version drift. One pinned version (
@v0.6.0) instead of@v3/@v3.0/@v1.1. - One place to maintain. The shared action is a from-scratch reimplementation (Netlify CLI +
actions/github-script), not a wrapper — CLI/behavior changes get fixed once, centrally. - Better reviewer UX. Deterministic preview URLs (
pr-<N>alias) and a single self-updating PR comment that links directly to the changed lecture pages. - De-risks Track 2. Getting
preview-netlifyadopted everywhere first makes it a known-good shared-action consumer in each repo before we touch the riskier build internals.
Current state (audit, June 2026)
| Repo | Preview today | Action / version | Production path | On quantecon/actions? |
|---|---|---|---|---|
| lecture-python.myst | Netlify | ✅ quantecon/actions/[email protected] |
gh-pages (peaceiris) | preview only — reference |
| lecture-dp | none | — | ✅ quantecon/actions/[email protected] |
fully (cache/build/publish) |
| lecture-python-intro | Netlify ×3 | nwtgck/[email protected] |
gh-pages + Netlify mirror | no |
| lecture-jax | Netlify ×2 | nwtgck/actions-netlify@v3 |
gh-pages (peaceiris) | no |
| lecture-python-programming | Netlify | nwtgck/actions-netlify@v3 |
GitHub Pages (native) | no |
| lecture-python-advanced.myst | Netlify | nwtgck/actions-netlify@v3 |
gh-pages (peaceiris) | no |
| continuous_time_mcs | Netlify | nwtgck/[email protected] |
gh-pages (peaceiris) | no |
Resolved decisions
- Version pin: exact
@v0.6.0in every repo (matchinglecture-python.myst) + Dependabot to bump. The moving@v0tag is not used — it currently lags (points at thev0.5.2commit, notv0.6.0). - Duplicate previews (
lecture-python-intro,lecture-jax): drop the preview fromcollab.ymlso it stays a pure Colab execution test; onlyci.ymldeploys a preview. One preview + one comment per PR. lecture-python-introNetlify production mirror (publish.yml): retire it as part of this work — gh-pages (intro.quantecon.org) remains the canonical production site; the redundant Netlify production deploy is removed.lecture-dp: include as net-new — provision a Netlify site + repo secrets and addpreview-netlifyto itsci.yml, bringing it to parity.
Target state
Every repo's PR preview is a single step:
- name: Preview Deploy to Netlify
uses: quantecon/actions/[email protected]
with:
netlify-auth-token: ${{ secrets.NETLIFY_AUTH_TOKEN }}
netlify-site-id: ${{ secrets.NETLIFY_SITE_ID }}
build-dir: _build/htmlPer-repo migration checklist (common steps)
- Replace the
nwtgck/actions-netlify@…step inci.ymlwith the shared-action step above. - Add job-level
permissions: { contents: read, pull-requests: write }(needed for the PR comment). - Ensure the
actions/checkoutstep usesfetch-depth: 0(needed for changed-page detection). - Ensure Node is available before the step (the action
npm i -g netlify-cli); addactions/setup-node@v6if the job doesn't already have Node, as the reference repo does. - Disable Netlify's native GitHub-App PR comments on the site so we don't get two comments per PR.
Behavioral changes to expect
- Preview-only. This action never does a production deploy (no
--prod). Production paths (gh-pages) are untouched. - Deterministic URL: alias hardcoded to
pr-<PR#>(most repos currently get random URLs). - PR comment: a single self-updating
📖 Netlify Preview Ready!comment with changed-page links, replacing thenwtgckcomment. - dependabot + fork PRs auto-skip the preview (they can't read secrets) — they get a skip log line instead of a failure.
Rollout (easy → hard)
- 1. continuous_time_mcs — swap the single
ci.ymlpreview step. (pilot) - 2. lecture-python-advanced.myst — swap the single
ci.ymlpreview step. (pilot) - 3. lecture-python-programming — swap
ci.yml; delete the stale.github/workflows/_github_actions/dir (dead@v1.1copy). - 4. lecture-jax — swap
ci.yml; drop the duplicate preview fromcollab.yml. - 5. lecture-python-intro — swap
ci.yml; drop the duplicate preview fromcollab.yml; retire the Netlify production mirror inpublish.yml(gh-pages remains canonical). - 6. lecture-dp — net-new: provision a Netlify site + repo secrets (
NETLIFY_SITE_ID; confirmNETLIFY_AUTH_TOKENis available), then addpreview-netlifytoci.yml. - lecture-python.myst — already done (reference). Minor cleanup: remove the unused
preview_pageworkflow_dispatchinput.
Out of scope / follow-ups
- Track 2 — full
quantecon/actions/*adoption per repo (setup-environment,restore-jupyter-cache,build-lectures,publish-gh-pages). Bigger and riskier: these repos have bespoke pipelines (RunsOn GPU AMIs,JAX[cuda], LaTeX PDF, Colab containers). Gating question: do the shared build/setup composites absorb those quirks?lecture-dpis the working template (though it's non-GPU). To be tracked separately. - Re-point the
@v0moving tag inQuantEcon/actionstov0.6.0(it currently lags at thev0.5.2commit). Not needed for this project since we pin exact versions, but worth fixing as a small standalone task. - Standardizing the production publish path (gh-pages variants across repos) — separate effort.
References
- Shared action: https://github.com/QuantEcon/actions/tree/main/preview-netlify (latest tag
v0.6.0) - Reference implementation:
QuantEcon/lecture-python.myst→.github/workflows/ci.yml, jobpreview
Audit performed June 2026 across the 6 Python lecture repos + continuous_time_mcs and the QuantEcon/actions composite actions.
Activity