Repository navigation
Add on-demand GitHub Pages previews of decks changed in pull requests - #28
Conversation
Following dandi/usage-page's preview.yml/preview-deploy.yml split: a read-only `pull_request` build and a `workflow_run` deploy to the gh-pages branch via rossjrw/pr-preview-action, with a sticky comment linking each deck. Only top-level *.html decks added/changed by the PR are previewed. tools/build_preview.py follows their local references (reveal.js, css/, pics/, ...) and copies just those files, fetching git-annex content from datasets.datalad.org first; content not available there is listed in the build summary rather than failing the build. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WaJ8d7w97BG5hbJVRr9B3M
Previews are now built only on request (Actions -> Preview -> Run workflow), with `deploy` or `remove`. Since nothing runs automatically on pull_request anymore, the workflow_run split is replaced by two jobs in one workflow: a read-only build of the PR's merge ref and a deploy job with write access that only receives the built files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WaJ8d7w97BG5hbJVRr9B3M
|
I get a bunch of interoperability issues when trying to build some of these slide decks through @yarikoptic Can you go to settings -> pages -> enable pages from branch (gh-pages)? |
|
(or give me admin for the day so I can fanangle with it) |
|
@yarikoptic here: made you admin here BUT note that we crossed in the internet -- I was just moving this repo over to https://hub.centerforopenneuroscience.org/con/talks . Where eventually we would deploy https://codeberg.org/git-pages/git-pages to fascilitate gh-pages like behaviors ... "migration" even moved issues and PRs ... we could for now continue here, and potentially re-migrate later etc if so desired I guess. |
|
note that it might become 'prohibitive' after committed directly to git images exceed ultimate size allowed etc. I think I ran into this with annextube demos etc... overall -- I feel that it might be a bit of a wasted effort , but you could be proven me wrong |
master carries the first 66 lines of the same .github/workflows/preview.yml (the shell that enables workflow_dispatch); keep this branch's complete file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WaJ8d7w97BG5hbJVRr9B3M
The first run built PR #26, whose checkout has no tools/build_preview.py (it only exists on this branch), so the build step had nothing to run. That went unnoticed because `python | tee` without pipefail succeeds, and upload-artifact only warned about the empty directory; the deploy job then failed to find the artifact. - Take tools/build_preview.py from $GITHUB_SHA (the workflow's own ref), so any PR can be previewed, and run it against the PR checkout (the script now builds from the current directory). - set -o pipefail in the build step; if-no-files-found: error on upload. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WaJ8d7w97BG5hbJVRr9B3M
@yarikoptic-gitmate I am a tad confused since that sounds like the real @yarikoptic but I was told that @yarikoptic-gitmate was only for "AI-produced" output (hence the entirely separate account?) Anway it's working great: https://con.github.io/talks/pr-preview/pr-27/2026-dhmc-ieeg.html#/4/6 If no qualms I will merge this later |
yarikoptic
left a comment
There was a problem hiding this comment.
yeah, it was me just in a browser where I had the mate's session, so I started the post with "@yarikoptic here:" to disambiguate.
Greate that it works, I glanced over and looks minimalistic enough which is pretty cool -- let's then get it for now, thanks!
…o enh-2026-dhmc-ieeg * 'enh-2026-dhmc-ieeg' of https://github.com/con/talks: Add on-demand GitHub Pages previews of decks changed in pull requests (#28) fix path instantiate workflow Apply batched suggestions from code review adjust in reponse to reviews
Manually triggered previews of only the decks a PR adds/changes (e.g.
2026-dhmc-ieeg.htmlin #26), published togh-pageslike dandi/usage-page does.How it works
.github/workflows/preview.ymlruns only onworkflow_dispatch(Actions → Preview → Run workflow) with two inputs: a PR number, anddeployorremove.build-previewjob (read-only token)refs/pull/<N>/merge;*.htmlfiles added/modified/renamed by the PR (git diff HEAD^1 HEAD), and fails clearly if there are none;reveal.js+reveal.js-mermaid-pluginsubmodules (not2022-nih-compcore, whose relative URL only resolves on datasets.datalad.org);origin/git-annex, addshttps://datasets.datalad.org/centerforopenneuroscience/talks/.gitas a remote andgit annex inits;tools/build_preview.py, taken from the workflow's own commit (so the PR being previewed doesn't need to contain it), against the PR checkout. It walks the deck's local references (src,data-src,data-background*,data-markdown, stylesheethrefs, markdown images, CSSurl()), recursing through HTML/CSS/MD, runsgit annex geton anything without content, and copies just those files (dereferenced) into the site;deploy-previewjob (write token; receives only the built files)rossjrw/pr-preview-actiontopr-preview/pr-<N>/ongh-pages, or removes that directory;Setup (done)
gh-pages/ root; that branch has a placeholderindex.htmland.nojekyll.masteralready has a copy of the workflow's opening section, so "Run workflow" is available. Until this is merged, select this branch under "Use workflow from".Testing
2026-dhmc-ieeg.html,git annex getfetched 8 files from datasets.datalad.org, 43 files were deployed, and the bot posted the preview link on 2026-dhmc-ieeg: NWB/NeuroConv + Neurosift event-related slides #27 → https://con.github.io/talks/pr-preview/pr-27/2026-dhmc-ieeg.html. Four images from Slide for the 2026 dhmc ieeg group meetup this Fri #26 whose content isn't on datasets.datalad.org yet were listed as missing, as intended.Known trade-off
Each deploy commits the preview's files to
gh-pages, so its history keeps growing (about 13 MB for that run). See the discussion below.🤖 Generated with Claude Code
https://claude.ai/code/session_01WaJ8d7w97BG5hbJVRr9B3M