Skip to content

Fix label-pr workflow checking out merge ref instead of PR head#7420

Merged
isaacroldan merged 1 commit into
mainfrom
04-28-fix_label-pr_workflow_checking_out_merge_ref_instead_of_pr_head
Apr 29, 2026
Merged

Fix label-pr workflow checking out merge ref instead of PR head#7420
isaacroldan merged 1 commit into
mainfrom
04-28-fix_label-pr_workflow_checking_out_merge_ref_instead_of_pr_head

Conversation

@isaacroldan

@isaacroldan isaacroldan commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

Summary

The Label PR workflow was assigning incorrect labels (e.g. Area: @shopify/cli instead of no-changelog) on PRs that don't include a changeset.

Root cause

actions/checkout@v4 defaults to checking out the merge ref (refs/pull/N/merge) for pull_request events. That ref is the PR head merged into the latest base branch, so git diff $BASE_SHA HEAD includes any changesets that landed on main after BASE_SHA — even though the PR didn't add them.

Example: PR #7384 (no changeset) was labeled Area: @shopify/cli because the merge ref contained 5 unrelated changesets that had merged into main between base.sha and now.

Fix

Pin the checkout ref to pull_request.head.sha so HEAD is the actual PR tip, not the merge ref.

Test plan

Copy link
Copy Markdown
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@isaacroldan isaacroldan marked this pull request as ready for review April 28, 2026 15:24
@isaacroldan isaacroldan requested a review from a team as a code owner April 28, 2026 15:24
Copilot AI review requested due to automatic review settings April 28, 2026 15:24
@github-actions github-actions Bot added the no-changelog This PR doesn't include a changeset entry. Is an internal only change not relevant to end users. label Apr 28, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes the Label PR GitHub Actions workflow so it labels pull requests based on the PR’s actual head commit, rather than the auto-generated merge ref, preventing unrelated base-branch changesets from affecting labeling.

Changes:

  • Pin actions/checkout to github.event.pull_request.head.sha so HEAD is the PR tip (not refs/pull/N/merge).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

isaacroldan commented Apr 29, 2026

Copy link
Copy Markdown
Contributor Author

Merge activity

  • Apr 29, 7:31 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Apr 29, 7:31 AM UTC: @isaacroldan added this pull request to the GitHub merge queue with Graphite.

@isaacroldan isaacroldan added this pull request to the merge queue Apr 29, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks Apr 29, 2026
@isaacroldan isaacroldan added this pull request to the merge queue Apr 29, 2026
@isaacroldan isaacroldan removed this pull request from the merge queue due to the queue being cleared Apr 29, 2026
@isaacroldan isaacroldan added this pull request to the merge queue Apr 29, 2026
Merged via the queue into main with commit 5007d7c Apr 29, 2026
32 checks passed
@isaacroldan isaacroldan deleted the 04-28-fix_label-pr_workflow_checking_out_merge_ref_instead_of_pr_head branch April 29, 2026 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog This PR doesn't include a changeset entry. Is an internal only change not relevant to end users.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants