You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
preview-cloudflare: deploy-url assumes the project's pages.dev address is its name #216
That is right only when the project is served at <project-name>.pages.dev. A Pages project's address is a separate field, its subdomain. wrangler 4.139.0, the pinned version, prints it when it creates a project: It will be available at https://${subdomain}/ (wrangler-dist/cli.js:299684). Cloudflare gives a project another address when its name is already taken on pages.dev, by adding a suffix. Then deploy-url, the comment's preview URL and every lecture link point at the wrong host, possibly at someone else's site.
deployment-url is not affected: it is read from wrangler's output.
Why it is built, not read
#14 made the URL constructed on purpose: the branch alias is stable across pushes, and building it needs no parsing of wrangler's output. That reasoning holds when the subdomain equals the name.
Options
Read the alias from wrangler's output. After a successful deploy, wrangler prints ✨ Deployment alias URL: <alias>, taken from the deployment's own aliases (cli.js:300222-300232). It is the right host in every case, but it brings back the parsing preview-cloudflare: Use branch alias URL instead of hash URL in PR comments #14 removed, and wrangler omits the line when its status call fails.
Look up the project's subdomain before deploying, with wrangler pages project list, or the API's GET /accounts/<account>/pages/projects/<name>, and build the URL from that. The URL stays constructed, at the cost of one more call with the same token.
An optional subdomain input, defaulting to project-name. It needs no new call, but a wrong value fails silently, as today.
Until then, the manual's preview-cloudflare chapter (#213) tells readers to check that their project is served at exactly https://<project-name>.pages.dev, and links here.
Checked against main at e40924a (v0.16.0), with wrangler 4.156.1, the pinned version. The problem is as described, and the URL is still built from project-name (preview-cloudflare/action.yml:285; the placeholder builds it the same way in scripts/preview-comment.cjs:30). It reaches no caller today: the one caller outside this repository, the canary's qe-preview-canary, is served at its own name, as wrangler's alias line in the v0.16.0 canary run shows. Cloudflare's docs don't say when a project gets a subdomain other than its name, but the API keeps subdomain apart from name, so the two can differ, and then every link in the comment points at the wrong host.
Since this was written, a simpler fix than option 2 has turned up. With WRANGLER_OUTPUT_FILE_PATH set, wrangler 4.156.1 writes a pages-deploy-detailed record after every successful deploy. Its url is the deployment's own URL, https://<hash>.<subdomain>, and it is there even when wrangler's status polls time out and it prints no alias. Cloudflare's own wrangler-action reads that record for its outputs. Taking the subdomain from it keeps #14's design (the alias URL is still built, and stable across pushes) with no extra API call and no new input. Option 2's lookup would work with the same token, since wrangler itself reads the project twice on every deploy, but it would add a token-bearing call and a failure point for the same answer.
The plan: the deploy step reads the record, checks the URL against a strict https://<label>.<subdomain>.pages.dev pattern, and builds deploy-url as https://<branch>.<subdomain>, with deployment-url from the same record. When the record names no such URL, it warns and falls back to today's <project-name>.pages.dev. When the subdomain differs from the name, it prints a notice. The placeholder keeps <project-name>.pages.dev: its job holds no Cloudflare secret by design, and the deploy's comment replaces it within minutes. A new harness job runs the deploy step against a stub wrangler, including a project served at harness-x7k.pages.dev, which today's code gets wrong. The release canary checks that the real wrangler's record gives qe-preview-canary the same URLs as now. It ships under Fixed in v0.17.0, with no breaking change.
The maintainer's decisions, 2026-11-07: the fix takes the subdomain from wrangler's pages-deploy-detailed record (a fourth option, in place of option 2's lookup). When the record names no URL of the expected shape, the step warns and falls back to today's <project-name>.pages.dev, with deployment-url empty. The placeholder does no lookup: the chapter says so, and the deploy prints a notice when the subdomain differs from the name. The CHANGELOG entry is Fixed, with no ⚠️ marker.
Claude Code (on behalf of mmcky), organiser session; the check by the mini:actions-cloudflare session
Activity
docs(manual): correct the preview and restore chapters against the code
docs(manual): chapters for the other seven actions, and delete QUICK-…
Merge main into fix/229-bjc-alert
mmcky commentedon Nov 7, 2026
Checked against
mainate40924a(v0.16.0), with wrangler 4.156.1, the pinned version. The problem is as described, and the URL is still built fromproject-name(preview-cloudflare/action.yml:285; the placeholder builds it the same way inscripts/preview-comment.cjs:30). It reaches no caller today: the one caller outside this repository, the canary'sqe-preview-canary, is served at its own name, as wrangler's alias line in the v0.16.0 canary run shows. Cloudflare's docs don't say when a project gets a subdomain other than its name, but the API keepssubdomainapart fromname, so the two can differ, and then every link in the comment points at the wrong host.Since this was written, a simpler fix than option 2 has turned up. With
WRANGLER_OUTPUT_FILE_PATHset, wrangler 4.156.1 writes apages-deploy-detailedrecord after every successful deploy. Itsurlis the deployment's own URL,https://<hash>.<subdomain>, and it is there even when wrangler's status polls time out and it prints no alias. Cloudflare's ownwrangler-actionreads that record for its outputs. Taking the subdomain from it keeps #14's design (the alias URL is still built, and stable across pushes) with no extra API call and no new input. Option 2's lookup would work with the same token, since wrangler itself reads the project twice on every deploy, but it would add a token-bearing call and a failure point for the same answer.The plan: the deploy step reads the record, checks the URL against a strict
https://<label>.<subdomain>.pages.devpattern, and buildsdeploy-urlashttps://<branch>.<subdomain>, withdeployment-urlfrom the same record. When the record names no such URL, it warns and falls back to today's<project-name>.pages.dev. When the subdomain differs from the name, it prints a notice. The placeholder keeps<project-name>.pages.dev: its job holds no Cloudflare secret by design, and the deploy's comment replaces it within minutes. A new harness job runs the deploy step against a stub wrangler, including a project served atharness-x7k.pages.dev, which today's code gets wrong. The release canary checks that the real wrangler's record givesqe-preview-canarythe same URLs as now. It ships under Fixed in v0.17.0, with no breaking change.The maintainer's decisions, 2026-11-07: the fix takes the subdomain from wrangler's⚠️ marker.
pages-deploy-detailedrecord (a fourth option, in place of option 2's lookup). When the record names no URL of the expected shape, the step warns and falls back to today's<project-name>.pages.dev, withdeployment-urlempty. The placeholder does no lookup: the chapter says so, and the deploy prints a notice when the subdomain differs from the name. The CHANGELOG entry is Fixed, with noClaude Code (on behalf of mmcky), organiser session; the check by the mini:actions-cloudflare session
Merge origin/main into fix/216-cloudflare-subdomain
fix(preview-cloudflare): build deploy-url on the address the deployme…