Repository navigation
Run PR previews in a separate preview environment - #255
Merged
Merged
Conversation
The production environment now only deploys from main, so it rejects the pull request refs that preview.yml runs on and the Preview job fails before its first step. Point the job at a `preview` environment instead and document which environment holds which credentials. The secret and variable names are unchanged. The `preview` environment is meant to hold a read-only GitHub App rather than the deploy App, the follow-up noted in #238. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016HDqNdz6KVjegQzqngoZKa
Pulumi PreviewClick to expand preview output |
Contributor
Author
|
The failing Preview Changes check is the expected state until the Generated by Claude Code |
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016HDqNdz6KVjegQzqngoZKa
pcarleton
approved these changes
Nov 24, 2026
This branch was successfully deployed
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.
Requested by Paul Carleton · Slack thread
Before: The Preview job runs in the
productionenvironment. That environment now rejects pull request refs, so every preview stops before its first step withBranch "refs/pull/N/merge" is not allowed to deploy to production due to environment protection rules(for example on #250).After: The Preview job runs in a
previewenvironment that accepts pull request refs and holds its own credentials.productionstaysmain-only and is used only bydeploy.yml, which is unchanged.How:
preview.ymlswitches toenvironment: preview, and the README describes the two environments. Secret and variable names are unchanged, so the job reads the same names frompreview. Fork and Dependabot pull requests are still skipped. This is the environment split from #204 and the "Separate App and environment for Preview" follow-up from #238. The reviewer gate from #204, and its move of every secret off repository level, are not part of this PR.Admin setup before merging
Status (2026-11-24): done. Paul Carleton added
DEPLOY_APP_CLIENT_IDandDEPLOY_APP_PRIVATE_KEYtopreview, and the Preview run on the current head (74f30be) succeeds in thepreviewenvironment. Every secret the "Preview changes" step reads resolved: passphrase, billing email, Discord bot token and guild ID, Cloudflare token, GCP key. The plan is~ 10 to update, 750 unchanged, which is the long-standing Google Workspace drift (OrgUnitmcp-org-unitand 9 GroupSettings), with no creates or deletes.In Settings → Environments:
preview: create it if it is not listed. Apreviewdeployment was recorded for Run previews in a separate reviewer-gated environment #204 on 2026-10-01, so GitHub may already have created it. Set "Deployment branches and tags" to No restriction. Leave required reviewers empty, unless every preview run should wait for an approval as Run previews in a separate reviewer-gated environment #204 proposed.DEPLOY_APP_CLIENT_IDinpreview: client ID of the GitHub App that Preview authenticates as.DEPLOY_APP_PRIVATE_KEYinpreview: a private key of that App.previewaccepts any branch, so anyone with write access here can run a workflow that reads its secrets, and the deploy App's key is equivalent to organization admin. The run shows that the credentials work, not which App they belong to.preview. Settings → Secrets and variables → Actions lists the repository-level names. GitHub never shows stored values, so each one has to come from its source. All six are visible to the job in the run above; the run does not show whether each is stored at repository level or inpreview.GCP_PROD_SERVICE_ACCOUNT_KEY: reads the Pulumi state ings://mcp-access-prod-pulumi-state.PULUMI_PROD_PASSPHRASE: decrypts theprodstack. It must be the passphrase Deploy uses.ORG_BILLING_EMAIL: the preview fails without it (src/github.tsreadsgithubBillingEmailwithrequireSecret).DISCORD_BOT_TOKENandDISCORD_GUILD_ID: same values as Deploy. Without them the preview shows every Discord resource as a delete. With a different token it shows them as updates.CLOUDFLARE_ROLE_MANAGEMENT_TOKEN: same value as Deploy. Without it the preview shows the Access policy as a delete.On 2026-10-01 the Preview run for #204 used the then-empty
previewenvironment and its log shows all six of these set, so they were repository-level secrets at that time. I could not check whether they still are.Ordering
preview, because pull request runs take the workflow from the PR's merge commit. To confirm after the setup above, push a commit or use "Update branch" so the preview runs against currentmain. A plain "Re-run" reuses the originalrefs/pull/N/mergecommit, so oncemainhas moved it can show false deletes for resources added there since.Test plan
npm run checkpasses (Prettier, config validation, 87 tests) andpreview.ymlparses as YAML. The functional test is the Preview run on this PR oncepreviewhas its credentials; it now passes (see Status above).