feat(wrangler): Add a new wrangler preview command group for Worker Previews#12983
Merged
petebacondarwin merged 49 commits intocloudflare:mainfrom Apr 9, 2026
Merged
Conversation
🦋 Changeset detectedLatest commit: a0e7656 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
|
Codeowners approval required for this PR:
Show detailed file reviewers
|
f9cf745 to
2ab5201
Compare
create-cloudflare
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-pool-workers
@cloudflare/workers-editor-shared
wrangler
commit: |
f165a2b to
14993e8
Compare
e4942f6 to
a65531f
Compare
penalosa
reviewed
Mar 20, 2026
Contributor
penalosa
left a comment
There was a problem hiding this comment.
First pass review—my main concern at this stage is code duplication, and using existing utilities from across the codebase.
dffb6fc to
9830a63
Compare
maxwellpeterson
added a commit
to maxwellpeterson/grangarda
that referenced
this pull request
Mar 20, 2026
…eploy - Add preview.yml: creates a Worker Preview on every PR using wrangler preview (prerelease from cloudflare/workers-sdk#12983), posts/updates a PR comment with the preview URL - Add deploy.yml: runs npm run deploy on pushes to main - Update wrangler to prerelease version from pkg.pr.new/wrangler@12983 - Replace deploy:preview script to call wrangler preview after build - Remove vite preview script (superseded by wrangler preview)
maxwellpeterson
added a commit
to maxwellpeterson/grangarda
that referenced
this pull request
Mar 20, 2026
* Add GitHub Actions workflows for preview deployments and production deploy - Add preview.yml: creates a Worker Preview on every PR using wrangler preview (prerelease from cloudflare/workers-sdk#12983), posts/updates a PR comment with the preview URL - Add deploy.yml: runs npm run deploy on pushes to main - Update wrangler to prerelease version from pkg.pr.new/wrangler@12983 - Replace deploy:preview script to call wrangler preview after build - Remove vite preview script (superseded by wrangler preview) * Fix: install wrangler prerelease as a workflow step, not in package.json npm ci rejects non-semver versions (URL-based installs), so the prerelease wrangler must be installed after npm ci rather than declared in package.json. * Fix: restore clean package-lock.json without pkg.pr.new URLs The lockfile had URL-resolved entries for wrangler and its sub-deps from the prerelease install, which caused npm ci to fail with 'Invalid Version'. * Fix: capture wrangler output before propagating exit code - Use set +e to prevent bash -e from aborting before we can echo output - Run Post preview comment step with if: always() so it posts even on failure * Fix: don't post PR comment on failure, fix output interpolation in github-script - Remove if: always() so comment only posts on successful deploy - Remove raw wrangler output interpolation into JS template literal which caused SyntaxError when output contained JS keywords * Fix: add CLOUDFLARE_ACCOUNT_ID env var to both workflows Wrangler fails in non-interactive mode when multiple accounts are available and no account ID is specified. * Fix: pass branch name as preview --name to avoid detached HEAD slug GitHub Actions checks out PRs in detached HEAD state, causing git rev-parse --abbrev-ref HEAD to return 'HEAD' -> slug 'head'. Pass --name explicitly using github.head_ref instead.
Contributor
|
Codeowners approval required for this PR:
Show detailed file reviewers
|
maxwellpeterson
added a commit
to maxwellpeterson/grangarda
that referenced
this pull request
Mar 25, 2026
Wrangler now reads GITHUB_HEAD_REF/GITHUB_REF_NAME natively (cloudflare/workers-sdk#12983), so we no longer need to manually derive and pass --name to the preview deploy command.
maxwellpeterson
added a commit
to maxwellpeterson/sfplvinyl.com
that referenced
this pull request
Mar 25, 2026
Wrangler now reads GITHUB_HEAD_REF/GITHUB_REF_NAME natively (cloudflare/workers-sdk#12983), so we no longer need to manually derive and pass --name to the preview deploy command.
maxwellpeterson
added a commit
to maxwellpeterson/grangarda
that referenced
this pull request
Mar 25, 2026
…#5) Wrangler now reads GITHUB_HEAD_REF/GITHUB_REF_NAME natively (cloudflare/workers-sdk#12983), so we no longer need to manually derive and pass --name to the preview deploy command.
maxwellpeterson
added a commit
to maxwellpeterson/sfplvinyl.com
that referenced
this pull request
Mar 25, 2026
…#4) Wrangler now reads GITHUB_HEAD_REF/GITHUB_REF_NAME natively (cloudflare/workers-sdk#12983), so we no longer need to manually derive and pass --name to the preview deploy command.
penalosa
approved these changes
Mar 27, 2026
`cpu_ms` shouldn't be required, and it should also support `subrequests`.
This reverts commit 6eaa39f.
…ssembling deployment modules
…s aren't consistent across CI environments
703a576 to
f72b833
Compare
workers-devprod
approved these changes
Apr 7, 2026
Contributor
workers-devprod
left a comment
There was a problem hiding this comment.
Codeowners reviews satisfied
penalosa
approved these changes
Apr 9, 2026
i.e. if a binding is declared at the top level of config, but not present in either of `"previews"` or the Worker's "Previews settings".
Merged
petebacondarwin
pushed a commit
that referenced
this pull request
Apr 13, 2026
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.
Refs IAC-362
This PR introduces a
wrangler previewfamily of commands for creating Preview deployments and managing Previews settings. This feature is currently limited to private beta status.New commands
wrangler previewwrangler preview deletewrangler preview settingswrangler preview settings updatewrangler preview secret putwrangler preview secret deletewrangler preview secret listwrangler preview secret bulkIt also introduces a
previewsproperty to the Wrangler config schema which includes all binding-related fields as well aslimits,observability, andlogpush. These fields all adhere to their existing heritability traits, withpreviewsitself being inheritable. This property allows users to specify an alternate configuration for their Worker's Preview deployments.Also included are some new box drawing utilities, though we may want to swap these out for a library like https://github.com/sindresorhus/boxen in the future.