Skip to content

Add PR preview environments - #4

Merged
Mathieson merged 1 commit into
mainfrom
claude/github-actions-preview-env-BMXtC
Jul 24, 2026
Merged

Add PR preview environments#4
Mathieson merged 1 commit into
mainfrom
claude/github-actions-preview-env-BMXtC

Conversation

@Mathieson

Copy link
Copy Markdown
Owner

Summary

  • Switches production deployment from the artifact-based Pages system to a gh-pages branch (peaceiris/actions-gh-pages@v4), which allows PR previews to coexist as subdirectories alongside the live site
  • Adds preview.yml: on every PR open/sync/reopen, builds Hugo with a PR-specific baseURL and deploys to pr-preview/pr-{number}/ via rossjrw/pr-preview-action; the action posts a comment on the PR with the live URL and auto-removes the subdirectory when the PR is closed
  • Draft posts (-D) are included in previews so in-progress content is visible before publish
  • Both workflows updated to use checkout@v7 and the pinned hugo-version: '0.155.3' already on main

After merging — one manual step required

GitHub Pages needs to be told to serve from the branch instead of Actions:

  1. Go to Settings → Pages
  2. Under Source, change from GitHub ActionsDeploy from a branch
  3. Set branch: gh-pages, folder: /Save

The gh-pages branch is created automatically the first time the updated deploy.yml runs on main (i.e. when this PR merges). Once Pages is pointed at it, the production URL https://mathieson.github.io/blog/ stays exactly the same.


Generated by Claude Code

Switch production deployment from artifact-based Pages to a gh-pages
branch (peaceiris/actions-gh-pages), enabling PR previews to coexist
as subdirectories alongside the live site.

Add preview.yml: on every PR open/sync/reopen, builds Hugo with a
PR-specific baseURL and deploys to pr-preview/pr-{number}/ on the
gh-pages branch via rossjrw/pr-preview-action. The action posts a
comment on the PR with the live preview URL and cleans up the
subdirectory automatically when the PR is closed.

https://claude.ai/code/session_01MA7Ekd1KB4MpXrC6aUeivs
@github-actions

github-actions Bot commented Jul 24, 2026

Copy link
Copy Markdown
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-07-24 23:32 UTC

@Mathieson
Mathieson merged commit faf4895 into main Jul 24, 2026
1 check passed
@Mathieson
Mathieson deleted the claude/github-actions-preview-env-BMXtC branch July 24, 2026 23:32
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