Skip to content

Inputs & outputs ​

Inputs ​

InputDefaultDescription
worker-prefix(required)Preview worker name prefix → <prefix>-pr-<PR#>
db-prefixworker-prefixPreview D1 name prefix → <prefix>-pr-<PR#>
modeautodeploy | teardown | auto
source-configwrangler.jsoncSource wrangler config
out-configwrangler.preview.jsoncRendered preview config path
config-envmainenv.<name> block to base the preview on
d1-locationapacLocation hint for created D1
migrations-dir(from config)Migrations directory
run-migrationstrueApply D1 migrations before deploy
sync-d1-from``Clone this source D1 (name) into the preview D1, then migrate
sync-r2-from``Sync this source R2 bucket (name) into the per-PR bucket
r2-endpoint-varR2_ENDPOINTEnv/config var holding the R2 S3 endpoint
r2-access-key-id-varR2_ACCESS_KEY_IDEnv/config var holding the R2 S3 access key id
r2-secret-access-key-varR2_SECRET_ACCESS_KEYEnv/config var holding the R2 S3 secret key
isolate-kvtrueCreate per-PR KV namespaces
isolate-r2trueCreate per-PR R2 buckets
preview-url-varsBETTER_AUTH_URLComma-separated vars set to the preview URL
wrangler-commandbunx wranglerHow to invoke wrangler
pre-deploy-command``Hook before deploy
post-deploy-command``Hook after deploy (migrations/seed/tests)
pre-teardown-command``Hook before teardown
shellbashShell for hooks
commenttrueUpsert sticky PR comment
github-token${{ github.token }}Token for the PR comment
cloudflare-account-id``Prefer CLOUDFLARE_ACCOUNT_ID env
cloudflare-api-token``Prefer CLOUDFLARE_API_TOKEN env

Outputs ​

OutputDescription
urlPreview workers.dev URL (deploy)
workerResolved preview worker name
dbResolved preview D1 name
db-idPreview D1 id (deploy)
configPath to the rendered preview config (deploy)

Environment ​

VariableUsed for
CLOUDFLARE_API_TOKENAll Cloudflare/wrangler operations (masked in logs)
CLOUDFLARE_ACCOUNT_IDAccount for resource creation + subdomain resolution
R2_ENDPOINT / R2_ACCESS_KEY_ID / R2_SECRET_ACCESS_KEYR2 S3 credentials for sync-r2-from (names configurable)

Released under the MIT License.