Skip to content

Make Pages job summaries environment-aware and omit undefined aliases #440

Description

@ofek

Describe the problem

For a production Cloudflare Pages deployment (example), the job summary generated by wrangler-action labels the immutable deployment URL as Preview URL and renders an absent branch alias as undefined:

# 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:

const octokit = getOctokit(config.GITHUB_TOKEN);
const [createGitHubDeploymentRes, createJobSummaryRes] =
await Promise.allSettled([
createGitHubDeployment({
config,
octokit,
deploymentUrl: pagesArtifactFields.url,
productionBranch: pagesArtifactFields.production_branch,
environment: pagesArtifactFields.environment,
deploymentId: pagesArtifactFields.deployment_id,
projectName: pagesArtifactFields.pages_project,
}),
createJobSummary({
commitHash:
pagesArtifactFields.deployment_trigger.metadata.commit_hash.substring(

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:

- 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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions