Fix pr-labeler for fork PRs (pull_request_target)#3581
Merged
Conversation
Contributor
|
Learn Build status updates of commit 93115ba: ✅ Validation status: passed
For more details, please refer to the build report. |
The workflow failed on fork PRs (#3579) because pull_request events only get a read-only GITHUB_TOKEN for forks. Switch to pull_request_target which runs in the base repo context with write permissions. Key changes: - Trigger: pull_request_target instead of pull_request - Checkout the PR head SHA explicitly (pull_request_target defaults to base) - Fetch base branch and diff against explicit refs Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
93115ba to
202c7c0
Compare
Contributor
|
Learn Build status updates of commit 202c7c0: ✅ Validation status: passed
For more details, please refer to the build report. |
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.
Problem
The \label-pr\ workflow fails on PRs from forks (#3579) with:
\
Resource not accessible by integration (403)
\\
This happens because \pull_request\ events only get a read-only \GITHUB_TOKEN\ for fork PRs, regardless of declared permissions.
Fix
Security note
\pull_request_target\ is safe here because we only read file content from the PR (no execution of PR-supplied code). The workflow script is always from the base branch.