CI/CD

For weeks, every branch push went to production

My site has one deploy rule: main is production, and everything else lands as a pull request from a branch with a Cloudflare preview URL. A hook even blocks pushing main directly.

From when the build trigger was set up, around the move to Workers in August, until 2026-10-31, every branch push went straight to production.


Two triggers, one command

Cloudflare’s Workers Builds had two triggers on the project. “Deploy default branch” for main, and “Deploy non-production branches” for everything else. Both ran the same command:

npx wrangler deploy

So a branch build didn’t make a preview. It replaced the live site. The build history shows it: six branch builds on 2026-09-29, all running wrangler deploy, all succeeding. I didn’t go looking for that. A Claude Code session checked the build history through the Builds API and found it.

One of those was the Worker whose own commit message said “Not to be merged until tried under wrangler dev”. I merged it three minutes after that commit. It was already live before I did. That story is in No Request Time Code.


The fix

The branch trigger runs this now:

npx wrangler versions upload

That uploads a version with its own preview URL and leaves production alone. Production only moves when main builds.

Deploy non-production branchesbranchwrangler deployversions uploadlive sitepreviewuntil 2026-10-31now: production moves only when main builds

The deploy rule in the repo now records what the trigger used to run, and says to check it first if a branch build ever shows up live.