Skip to content

Add interactive PR previews via gh-pages branch#46

Merged
cmccoy merged 1 commit into
mainfrom
claude/pr-preview-infra-njgrpu
Jun 26, 2026
Merged

Add interactive PR previews via gh-pages branch#46
cmccoy merged 1 commit into
mainfrom
claude/pr-preview-infra-njgrpu

Conversation

@cmccoy

@cmccoy cmccoy commented Jun 26, 2026

Copy link
Copy Markdown
Owner

What

Sets up infrastructure so reviewers can click through a live, interactive preview of any PR that changes the site, at https://www.cmccoy.us/pr-preview/pr-<N>/, with a sticky comment on the PR linking to it. The preview is removed automatically when the PR closes.

Why this shape

Interactive previews on GitHub Pages require the Pages source to be a branch — a repo has exactly one Pages source, so previews and production must share a hosting mechanism. This moves production off the "GitHub Actions" Pages source and onto a gh-pages branch, then deploys previews into a pr-preview/ subdirectory of that same branch. Fully self-hosted — no external services, accounts, or secrets, in keeping with the repo's minimal/self-contained philosophy.

Changes

  • .github/workflows/jekyll.yml — production now builds on main and publishes _site/ to the gh-pages branch via JamesIves/github-pages-deploy-action, preserving PR previews with clean-exclude: pr-preview/. CNAME is carried into the published output, so the custom domain is preserved.
  • .github/workflows/pr-preview.yml (new) — builds each PR with --baseurl /pr-preview/pr-<N> and deploys via rossjrw/pr-preview-action.
  • index.md — fixed two hardcoded absolute /js/ script paths to use relative_url so they resolve under the preview subpath. (Verified locally: prod build keeps /js/..., preview build emits /pr-preview/pr-1/js/....)
  • CLAUDE.md — documents the new deploy flow, the one-time Pages setting, and a known caveat about absolute asset paths inside static JS.

⚠️ One required manual step

After merge, change Settings → Pages → Build and deployment → Source to "Deploy from a branch" → gh-pages / (root). Until then, production keeps serving the last "GitHub Actions" deploy (it won't break, just won't update) and preview URLs will 404. Merging this triggers the production workflow, which creates the gh-pages branch so the setting is ready to flip.

🤖 Generated with Claude Code

https://claude.ai/code/session_01DstwP2knezUiaBVqpBSZgR


Generated by Claude Code

Set up infrastructure so reviewers can click through a live preview of any
PR that changes the site.

- Move production deploy off the "GitHub Actions" Pages source and onto the
  gh-pages branch (JamesIves/github-pages-deploy-action). This is required so
  PR previews can share a hosting mechanism with production — a repo has only
  one Pages source.
- Add pr-preview.yml: builds each PR with --baseurl /pr-preview/pr-<N> and
  deploys an interactive preview to www.cmccoy.us/pr-preview/pr-<N>/ via
  rossjrw/pr-preview-action, with a sticky PR comment. Production deploys
  preserve previews (clean-exclude: pr-preview/); previews are removed when
  the PR closes.
- Fix two hardcoded absolute /js/ script paths in index.md to use relative_url
  so they resolve correctly under a preview subpath.
- Document the new deploy flow, the one-time Pages-source setting, and the
  static-JS absolute-asset-path caveat in CLAUDE.md.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DstwP2knezUiaBVqpBSZgR
@cmccoy cmccoy merged commit 0c46136 into main Jun 26, 2026
1 check failed
cmccoy pushed a commit that referenced this pull request Jun 27, 2026
Remove the PR preview setup (PRs #46 and #47) and restore production
deployment to its original form.

- jekyll.yml: back to the plain push-to-main actions/deploy-pages workflow
  (no workflow_run trigger, no preview overlay).
- Delete pr-preview.yml.
- index.md: restore the original absolute /js/ script paths.
- CLAUDE.md: restore the original Deployment section.

Unrelated World Cup content updates are preserved.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DstwP2knezUiaBVqpBSZgR
@claude claude Bot mentioned this pull request Jun 27, 2026
claude Bot added a commit that referenced this pull request Jun 27, 2026
Remove the PR preview setup (PRs #46 and #47) and restore production
deployment to its original form.

- jekyll.yml: back to the plain push-to-main actions/deploy-pages workflow
  (no workflow_run trigger, no preview overlay).
- Delete pr-preview.yml.
- index.md: restore the original absolute /js/ script paths.
- CLAUDE.md: restore the original Deployment section.

Unrelated World Cup content updates are preserved.


Claude-Session: https://claude.ai/code/session_01DstwP2knezUiaBVqpBSZgR

Co-authored-by: Claude <noreply@anthropic.com>
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.

2 participants