Skip to content

Add on-demand GitHub Pages previews of decks changed in pull requests - #28

Merged
CodyCBakerPhD merged 6 commits into
masterfrom
claude/friendly-cannon-xl1rhb
Oct 8, 2026
Merged

CodyCBakerPhD merged 6 commits into
masterfrom
claude/friendly-cannon-xl1rhb

Conversation

@CodyCBakerPhD

@CodyCBakerPhD CodyCBakerPhD commented Oct 7, 2026 •

Copy link
Copy Markdown
Collaborator

Manually triggered previews of only the decks a PR adds/changes (e.g. 2026-dhmc-ieeg.html in #26), published to gh-pages like dandi/usage-page does.

How it works

.github/workflows/preview.yml runs only on workflow_dispatch (Actions → Preview → Run workflow) with two inputs: a PR number, and deploy or remove.

  • build-preview job (read-only token)
    • checks the PR is open and checks out its merge ref refs/pull/<N>/merge;
    • finds top-level *.html files added/modified/renamed by the PR (git diff HEAD^1 HEAD), and fails clearly if there are none;
    • inits only the reveal.js + reveal.js-mermaid-plugin submodules (not 2022-nih-compcore, whose relative URL only resolves on datasets.datalad.org);
    • installs git-annex, fetches origin/git-annex, adds https://datasets.datalad.org/centerforopenneuroscience/talks/.git as a remote and git annex inits;
    • runs 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, stylesheet hrefs, markdown images, CSS url()), recursing through HTML/CSS/MD, runs git annex get on anything without content, and copies just those files (dereferenced) into the site;
    • content it could not get (e.g. not yet pushed to datasets.datalad.org) is listed in the job summary and as warnings; the build does not fail.
  • deploy-preview job (write token; receives only the built files)
    • deploys with rossjrw/pr-preview-action to pr-preview/pr-<N>/ on gh-pages, or removes that directory;
    • posts or updates a single comment on the PR linking each changed deck directly.

Setup (done)

  • Pages is served from gh-pages / root; that branch has a placeholder index.html and .nojekyll.
  • Actions workflow permissions: Read and write.
  • master already 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

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

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
@CodyCBakerPhD CodyCBakerPhD self-assigned this Oct 7, 2026
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
@CodyCBakerPhD CodyCBakerPhD changed the title Add GitHub Pages previews of decks changed in pull requests Add on-demand GitHub Pages previews of decks changed in pull requests Oct 7, 2026
@CodyCBakerPhD

Copy link
Copy Markdown
Collaborator Author

I get a bunch of interoperability issues when trying to build some of these slide decks through npm (even when build is successful) - would be nice to have centralized, stable builder to serve and be convenience to preview the deployment prior to moving to its final destination

@yarikoptic Can you go to settings -> pages -> enable pages from branch (gh-pages)?

@CodyCBakerPhD
CodyCBakerPhD marked this pull request as ready for review October 7, 2026 19:10
@CodyCBakerPhD

Copy link
Copy Markdown
Collaborator Author

(or give me admin for the day so I can fanangle with it)

@yarikoptic-gitmate

Copy link
Copy Markdown
Collaborator

@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.

@yarikoptic-gitmate

Copy link
Copy Markdown
Collaborator

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

Comment thread README.md Outdated
CodyCBakerPhD and others added 4 commits October 7, 2026 16:12
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
@CodyCBakerPhD

CodyCBakerPhD commented Oct 7, 2026 •

Copy link
Copy Markdown
Collaborator Author

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

@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 yarikoptic left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

@CodyCBakerPhD
CodyCBakerPhD merged commit 00066a0 into master Oct 8, 2026
2 checks passed
@CodyCBakerPhD
CodyCBakerPhD deleted the claude/friendly-cannon-xl1rhb branch October 8, 2026 02:26
yarikoptic added a commit that referenced this pull request Oct 8, 2026
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants