Add per-PR Cloudflare preview deploys - #953
Merged
Merged
Conversation
Every same-repo pull request gets an isolated preview of the Cloudflare host on a dedicated preview account: its own Worker, D1 database, encryption key, and Cloudflare Access application (MCP-OAuth-aware, edge-enforced on the workers.dev hostname), deployed on PR open/sync and destroyed on close. A nightly sweeper removes previews whose PR is no longer open. Teardown is stateless: every resource a preview owns is derived from its PR number.
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
executor-cloud | a17a1e4 | Jun 11 2026, 09:29 PM |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
executor-marketing | a17a1e4 | Commit Preview URL Branch Preview URL |
Jun 11 2026, 09:28 PM |
Contributor
Cloudflare previewTorn down — the PR is closed. |
@executor-js/cli
@executor-js/config
@executor-js/execution
@executor-js/sdk
@executor-js/codemode-core
@executor-js/runtime-quickjs
@executor-js/plugin-file-secrets
@executor-js/plugin-graphql
@executor-js/plugin-keychain
@executor-js/plugin-mcp
@executor-js/plugin-onepassword
@executor-js/plugin-openapi
executor
commit: |
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.
Every same-repo pull request now gets an isolated preview deployment of the Cloudflare host, torn down when the PR closes.
How it works
apps/host-cloudflare/scripts/preview.ts(deploy | destroy | list --pr N) provisions one stack per PR on a dedicated preview Cloudflare account: a Worker (executor-preview-pr-<n>), its own D1 database, a fresh at-rest encryption key, and its own Cloudflare Access application created via API — MCP-OAuth-aware (dynamic client registration enabled), edge-enforced on the workers.dev hostname, with an email allowlist policy. Previews are never publicly open: browsers get the Access login, unauthenticated/mcpgets the standard 401 +resource_metadataOAuth challenge.wrangler.jsoncwith asserted substitutions, so previews deploy the same config self-hosters use and config drift fails loudly.executor-preview-blobs) is reused across previews — blobs are only reachable via pointers in each preview's private D1, and leaving the bucket keeps teardown trivial.Workflows
preview.yml: deploy on PR open/reopen/sync, sticky comment with console + MCP URLs, teardown on close. Fork PRs are skipped — they never run with the deploy token. Concurrency is per-PR.preview-sweep.yml: nightly sweep that destroys previews whose PR is no longer open (catches force-push and cancelled-run orphans).Repo configuration (already set): secret
CLOUDFLARE_PREVIEW_API_TOKENplus variablesCLOUDFLARE_PREVIEW_ACCOUNT_ID,PREVIEW_ACCESS_TEAM_DOMAIN,PREVIEW_ACCESS_EMAILS.The deploy/redeploy/destroy cycle was verified end-to-end against the preview account, including the Access gate on both the console and MCP surfaces.
Also extends the relaxed lint override for script files to
apps/*/scripts/**and gitignores the generatedwrangler.preview.jsonc.