Preview Playground PR builds from artifacts#3700
Draft
adamziel wants to merge 1 commit into
Draft
Conversation
1988bc4 to
de61288
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Adds the runtime and server pieces for artifact-backed WordPress Playground PR previews via
?playground-pr=<number>.This PR is stacked on top of #3703, which only adds the CI workflow that produces
playground-pr-preview-<pr>-<sha>artifacts.This PR adds:
/pr-previews/<pr>/current.jsonand/pr-previews/<pr>/<sha>/...routing backed by GitHub Actions artifactssw.js?playground-pr=<number>Why
This lets maintainers preview Playground PR builds without deploying PR files to production paths. The browser still uses same-origin URLs, which is required for a root-scoped service worker, while the backing files come from GitHub Actions artifacts.
How to test locally
First, run the CI workflow from #3703 for a PR so the
playground-pr-preview-<pr>-<sha>artifact exists. Then run a PHP-routed local server withGITHUB_TOKENso/pr-previews/...requests execute the artifact proxy instead of falling back to staticindex.html.Testing
npm exec nx test playground-website -- --runnpm exec nx test playground-remote -- --runnpm exec nx typecheck playground-websitenpm exec nx typecheck playground-remotenpm exec nx lint playground-websitenpm exec nx lint playground-remotephp packages/playground/website-deployment/tests.phpnpm exec nx build playground-website