ci: add Cloudflare Pages preview deploys on PRs - #10
Merged
Conversation
Adds .github/workflows/web-preview.yml: on every PR push touching web/** (or shared/**), build web/ and publish an isolated Cloudflare Pages PREVIEW via `wrangler pages deploy dist/client --project-name=gpui-query --branch=pr-<N>`, then post/update a sticky PR comment with the stable alias (pr-<N>.gpui-query.pages.dev) and the unique deployment URL. Production (master) is untouched — it still deploys only via deploy.yml. Fork PRs are skipped (no access to the Cloudflare secrets). Reuses the existing CLOUDFLARE_API_TOKEN / CLOUDFLARE_ACCOUNT_ID. Validated with actionlint (clean). Note: a pull_request workflow only fires once the file is on the base branch, so this must merge to master before subsequent web PRs get preview URLs.
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
Adds
.github/workflows/web-preview.yml: on every PR push touchingweb/**orshared/**, it buildsweb/and publishes an isolated Cloudflare Pages preview deployment, then posts/updates a sticky PR comment with the preview URL.Production (
master) is completely unaffected — it still deploys only via the existingDeploy Websiteworkflow.How
Mirrors
deploy.yml(build) +pr-checks.yml(trigger/path filter) and reuses the existingCLOUDFLARE_API_TOKEN/CLOUDFLARE_ACCOUNT_IDsecrets:web/(bun + node 24,CLOUDFLARE_INCLUDE_PROCESS_ENV=true).wrangler pages deploy dist/client --project-name=gpui-query --branch=pr-<N>— the non-masterbranch is what makes it a preview (served atpr-<N>.gpui-query.pages.dev+ a unique<hash>.pages.dev).actions/github-scriptfinds the previous preview comment (HTML marker) and updates it, else creates it.Details
web/**/shared/**/ workflow file.github.event.pull_request.head.repo.full_name == github.repository) — they can't see the Cloudflare secrets.contents: read,pull-requests: write.Verification
actionlintclean (exit 0, no warnings).deploy.yml's proven pipeline.Activation caveat
A
pull_requestworkflow only fires once the file is on the base branch, so this must merge tomasterbefore subsequent web PRs start getting preview URLs.Caveat
403, theCLOUDFLARE_API_TOKENis scoped to the production branch only — widen it to allow non-production deploys (one-time, dashboard).