Repository navigation
ci: add Worker Previews alongside Workers for Platforms previews - #34369
Conversation
AI Review✅ Reviewed Commands
|
🚀 Deploying Preview to Cloudflare 🚀Preview URL: https://ci-worker-previews-gh-actions.previews.developers.cloudflare.com (commit 39ce8e4)This URL reflects your latest Preview deploymentPreview Deployments by commit |
|
Worker Preview URL: https://gh-ci-worker-previews-gh-actions.previews.developers.cloudflare.com Files with changes (up to 15) |
|
Preview URL: https://39ce8e47.preview.developers.cloudflare.com Files with changes (up to 15) |
|
/bonk please review |
|
Review: 1 finding. Posted 1 inline finding on |
3af5ba3 to
39ce8e4
Compare
Summary
Adds Worker Previews to PR CI, next to the existing Workers for Platforms (dispatch namespace) previews. Nothing is removed; both run on every same-repo PR.
New
publish-worker-previewjob runs in parallel withpublish-preview. It runswrangler preview --config wrangler.preview.jsonon thecloudflare-docsWorker.The job fails CI if the Worker Preview deploy fails. Only the final comment-posting step is
continue-on-error.Preview name is
gh-<branch-slug>, so it never collides with the Previews Workers Builds creates from the bare branch slug on the same*.previews.developers.cloudflare.comdomain.URLs come from wrangler's JSON output (
WRANGLER_OUTPUT_FILE_PATH), not hand-built.Each preview posts its own PR comment from its own script, found by its own marker line:
post-preview-url-comment/index.ts**Preview URL:**post-preview-url-comment/worker-preview.ts**Worker Preview URL:**Both comments include a changed-files table linking to their own host. Shared logic lives in
shared.ts.New
preview-cleanup.ymldeletes thegh-Preview when a PR closes.bin/preview-name.tsis shared by the deploy and cleanup workflows so both always target the same name. It strips a leadinggh-from the branch, caps the name at 63 characters (DNS label limit) and has unit tests.Notes:
wrangler.preview.jsonalready has thepreviewsblock withMIDDLECACHE, so these Previews get that binding.CLOUDFLARE_API_TOKENcan create Previews oncloudflare-docs.