Skip to content

Add per-PR preview deployment workflow#3348

Merged
JiuqingSong merged 2 commits into
masterfrom
add-pr-preview-workflow
May 21, 2026
Merged

Add per-PR preview deployment workflow#3348
JiuqingSong merged 2 commits into
masterfrom
add-pr-preview-workflow

Conversation

@JiuqingSong
Copy link
Copy Markdown
Collaborator

Summary

  • New workflow pr-preview.yml deploys each PR's demo site to gh-pages/pr-preview/pr-<n>/ using rossjrw/pr-preview-action. The action comments the preview URL on the PR, redeploys on push, and removes the directory when the PR is closed or merged.
  • Updates build-and-deploy.yml with CLEAN_EXCLUDE: '["pr-preview/**"]' so master deploys no longer wipe per-PR preview directories from the gh-pages branch.
  • Skips fork PRs (the if: guard) because GITHUB_TOKEN is read-only in that context and cannot push to gh-pages. Fork support can be added later via a workflow_run-based design.

Test plan

  • This PR itself triggers the new workflow — preview URL is posted as a comment by the action.
  • Visit the posted URL and confirm the demo loads.
  • Push an additional commit to this branch and confirm the preview redeploys.
  • After merge, open a follow-up PR and confirm a master deploy (triggered by this merge) did not wipe the new PR's preview directory.
  • Close a test PR and confirm pr-preview/pr-<n>/ is removed from gh-pages and the comment is updated.

🤖 Generated with Claude Code

Deploys the demo for each pull request to gh-pages/pr-preview/pr-N/
via rossjrw/pr-preview-action. The action comments the preview URL
on the PR, redeploys on push, and removes the directory on close.

Adds CLEAN_EXCLUDE to the existing master deploy so that master
deploys do not wipe out per-PR preview directories on gh-pages.

Fork PRs are skipped because GITHUB_TOKEN is read-only in that
context and cannot push to gh-pages.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 21, 2026

PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-05-21 18:50 UTC

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a per–pull request GitHub Pages preview deployment so each PR can publish a demo build under a stable URL on the gh-pages branch without being wiped by the main deploy workflow.

Changes:

  • Introduces pr-preview.yml to build and deploy PR previews to gh-pages/pr-preview/pr-<n>/ and clean them up on PR close/merge.
  • Updates the existing build-and-deploy.yml to exclude pr-preview/** from the branch-clean step so PR previews persist across master deploys.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
.github/workflows/pr-preview.yml New PR-triggered workflow to build and deploy per-PR preview sites to gh-pages.
.github/workflows/build-and-deploy.yml Prevents the main deploy job from deleting PR preview directories on gh-pages.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/pr-preview.yml Outdated
Address Copilot review feedback: the action runs with contents: write
and pull-requests: write, so pin to the v1.8.1 commit SHA instead of
the moving v1 tag to prevent upstream tag re-pointing from silently
altering what executes with that access.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@JiuqingSong JiuqingSong merged commit 71affcd into master May 21, 2026
8 checks passed
@JiuqingSong JiuqingSong deleted the add-pr-preview-workflow branch May 21, 2026 18:47
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.

3 participants