fix: use pull_request_target for labeler to support fork PRs#4
Merged
nnandan-postman merged 1 commit intoPostman-Devrel:mainfrom Apr 11, 2026
Merged
Conversation
Merged
nnandan-postman
approved these changes
Apr 10, 2026
Contributor
Author
|
@nnandan-postman Thanks for the approval! If everything looks good on your end, feel free to merge it whenever you're ready 🙏 |
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 current
PR Labelerworkflow uses thepull_requestevent, which restrictsGITHUB_TOKENto read-only permissions for PRs from forked repositories. This causes the labeler to fail with a permission error when external contributors open PRs.An example of the labeler failing in this problem:
PR Labelerfailed due to permission issue - Action for PR Fix Postman API key links #2Solution
Change the trigger from
pull_requesttopull_request_target, which runs in the context of the base repository and allowspull-requests: writeto work correctly for fork PRs.relevant link: https://github.com/actions/labeler?tab=readme-ov-file#recommended-permissions
Note
pull_request_targetcan be a security risk if forked code is checked out and executed. This workflow only adds labels and does not checkout any code, so this change is safe.