Skip to content

fix(release): gate canary releases on PR label#7717

Open
jonrohan wants to merge 4 commits intomainfrom
release_canary_label_workflow
Open

fix(release): gate canary releases on PR label#7717
jonrohan wants to merge 4 commits intomainfrom
release_canary_label_workflow

Conversation

@jonrohan
Copy link
Copy Markdown
Member

@jonrohan jonrohan commented Mar 30, 2026

Updates the release-canary job in the Release workflow so that canary releases are opt-in via a "Canary Release" label on a PR, rather than running on every branch push.

Changes:

  • Added pull_request: types: [labeled, synchronize] trigger to the workflow
  • release-canary now only runs when:
    • The "Canary Release" label is applied to a PR, or
    • A new commit is pushed to a PR that already has the "Canary Release" label
  • release-main and release-candidate are gated with github.event_name != 'pull_request' so they skip PR label events
  • Checkout uses github.event.pull_request.head.sha for the canary job to build the actual PR head commit

Changelog

New

Changed

  • Canary releases are now opt-in via the "Canary Release" PR label instead of running on every branch push

Removed

Rollout strategy

  • Patch release
  • Minor release
  • Major release; if selected, include a written rollout or migration plan
  • None; if selected, include a brief description as to why

This is a CI workflow change only — no package code is modified.

Testing & Reviewing

  • Verify that pushing to main still triggers only release-main
  • Verify that pushing to changeset-release/main still triggers only release-candidate
  • Verify that applying the "Canary Release" label to a PR triggers release-canary
  • Verify that pushing to a labeled PR re-triggers release-canary
  • Verify that pushing to a branch (without a labeled PR) does not trigger any release job

Merge checklist

  • Added/updated tests
  • Added/updated documentation
  • Added/updated previews (Storybook)
  • Changes are SSR compatible
  • Tested in Chrome
  • Tested in Firefox
  • Tested in Safari
  • Tested in Edge
  • (GitHub staff only) Integration tests pass at github/github-ui

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 30, 2026

⚠️ No Changeset found

Latest commit: 211680b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions github-actions bot added the staff Author is a staff member label Mar 30, 2026
@jonrohan jonrohan added skip changeset This change does not need a changelog integration-tests: skipped manually Changes in this PR do not require an integration test labels Mar 30, 2026
@jonrohan jonrohan marked this pull request as ready for review March 30, 2026 17:48
@jonrohan jonrohan requested a review from a team as a code owner March 30, 2026 17:48
@jonrohan jonrohan requested review from TylerJDev and Copilot March 30, 2026 17:48
@jonrohan jonrohan added the Canary Release Apply this label when you want CI to create a canary release of the current PR label Mar 30, 2026
@jonrohan jonrohan enabled auto-merge March 30, 2026 17:50
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the Release GitHub Actions workflow so canary publishing is opt-in via a “Canary Release” PR label, while ensuring main and candidate releases don’t run for PR label/sync events.

Changes:

  • Add pull_request triggers (labeled, synchronize) to support label-driven canary runs.
  • Gate release-canary on label presence and check out the PR head SHA for builds.
  • Prevent release-main and release-candidate from running on pull_request events.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
.github/workflows/release.yml Adds PR triggers and job-level if: gating so canary runs only when labeled; main/candidate skip PR events; canary checks out PR head SHA.
.github/pull_request_template.md Documents how to trigger a canary release via the “Canary Release” label.
Comments suppressed due to low confidence (1)

.github/workflows/release.yml:126

  • actions/checkout is using ref: ${{ github.event.pull_request.head.sha }} but doesn’t set repository:. For forked PRs that commit SHA usually isn’t in github.repository, so checkout will fail unless you also set with.repository: ${{ github.event.pull_request.head.repo.full_name }} (or ensure the job never runs for forks).
      - name: Checkout repository
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
        with:
          ref: ${{ github.event.pull_request.head.sha }}
          # This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits

@github-actions github-actions bot temporarily deployed to storybook-preview-7717 March 30, 2026 17:51 Inactive
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@github-actions github-actions bot requested a deployment to storybook-preview-7717 March 30, 2026 17:58 Abandoned
@siddharthkp
Copy link
Copy Markdown
Member

Would be good to recommend this label in https://github.com/primer/react/blob/main/.github/workflows/recommend-integration-tests.yml as well

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

Labels

Canary Release Apply this label when you want CI to create a canary release of the current PR integration-tests: skipped manually Changes in this PR do not require an integration test skip changeset This change does not need a changelog staff Author is a staff member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants