cloudflare / cloudflare/wrangler-action
Make Pages job summaries environment-aware and omit undefined aliases
- Dominant language
- TypeScript
- Stars
- 1.9k
- Forks
- 214
- PR merge metrics
- No merged PRs in 30d
Description
### Describe the problem
For a production Cloudflare Pages deployment ([example](https://github.com/msgspec/msgspec/actions/runs/27277969580/job/80564265987)), the job summary generated by `wrangler-action` labels the immutable deployment URL as **Preview URL** and renders an absent branch alias as `undefined`:
```markdown
# Deploying with Cloudflare Pages
| Name | Result |
| --- | --- |
| **Last commit:** | 7af4883c |
| **Preview URL**: | https://0a0c3946.msgspec.pages.dev |
| **Branch Preview URL**: | undefined |
```
The deployment itself is correctly classified and published as production. The misleading labels come from `createJobSummary`, which always uses `Preview URL` and `Branch Preview URL`, even though `createGitHubDeploymentAndJobSummary` already receives the Pages deployment environment and an optional alias.
Relevant implementation:
https://github.com/cloudflare/wrangler-action/blob/a61fbea3226347cc885c6d1b26b3f47b48e6c0f8/src/service/github.ts#L97-L111
### Reproduction
Use `cloudflare/wrangler-action` for a Pages direct upload targeting the project's production branch and provide `gitHubToken` so the action generates its GitHub deployment and job summary:
```yaml
- uses: cloudflare/wrangler-action@v4
with:
accountId: ${{ secrets.CF_ACCOUNT_ID }}
apiToken: ${{ secrets.CF_PAGES_TOKEN }}
command: pages deploy site --project-name=msgspec --branch=cf-pages
gitHubToken: ${{ github.token }}
```
When `cf-pages` is the project's configured production branch, the deployment is production but the generated summary still calls its immutable deployment URL a preview URL.
### Proposed behavior
Make the generated Pages summary environment-aware:
- For production deployments, label the immutable URL **Deployment URL** or **Production Deployment URL**.
- For preview deployments, retain **Preview URL**.
- Only include **Branch Preview URL** when an alias URL exists, rather than displaying `undefined`.
An additional useful option would be separate controls for GitHub Deployment creation and job-summary generation. Currently, omitting `gitHubToken` disables both behaviors together.
Contributor guide
Research direction
Start in src/service/github.ts at createJobSummary and trace how createGitHubDeploymentAndJobSummary passes the Pages environment and optional alias. Use the provided Pages production-branch reproduction to verify the summary labels the immutable URL appropriately and omits Branch Preview URL when no alias exists; preserve Preview URL for preview deployments.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github-actions, typescript
- Domain
- ci-cd, cloud
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 72/100