Fix label-pr workflow checking out merge ref instead of PR head#7420
Merged
isaacroldan merged 1 commit intoApr 29, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
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/checkouttogithub.event.pull_request.head.shasoHEADis the PR tip (notrefs/pull/N/merge).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
alfonso-noriega
approved these changes
Apr 29, 2026
Contributor
Author
Merge activity
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
The Label PR workflow was assigning incorrect labels (e.g.
Area: @shopify/cliinstead ofno-changelog) on PRs that don't include a changeset.Root cause
actions/checkout@v4defaults to checking out the merge ref (refs/pull/N/merge) forpull_requestevents. That ref is the PR head merged into the latest base branch, sogit diff $BASE_SHA HEADincludes any changesets that landed onmainafterBASE_SHA— even though the PR didn't add them.Example: PR #7384 (no changeset) was labeled
Area: @shopify/clibecause the merge ref contained 5 unrelated changesets that had merged into main betweenbase.shaand now.Fix
Pin the checkout ref to
pull_request.head.shasoHEADis the actual PR tip, not the merge ref.Test plan
base.shaand merge ref — confirms 5 phantom changesets appear with the merge ref and 0 with the head SHA.pull_requestevent on a no-changeset PR receivesno-changelog.