Skip to content

fix: use pull_request_target for labeler to support fork PRs#4

Merged
nnandan-postman merged 1 commit intoPostman-Devrel:mainfrom
yokawasa:use-pull_request_target
Apr 11, 2026
Merged

fix: use pull_request_target for labeler to support fork PRs#4
nnandan-postman merged 1 commit intoPostman-Devrel:mainfrom
yokawasa:use-pull_request_target

Conversation

@yokawasa
Copy link
Copy Markdown
Contributor

@yokawasa yokawasa commented Apr 10, 2026

Problem

The current PR Labeler workflow uses the pull_request event, which restricts GITHUB_TOKEN to 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:

Solution

Change the trigger from pull_request to pull_request_target, which runs in the context of the base repository and allows pull-requests: write to work correctly for fork PRs.

relevant link: https://github.com/actions/labeler?tab=readme-ov-file#recommended-permissions

Note

pull_request_target can 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.

@yokawasa yokawasa mentioned this pull request Apr 10, 2026
@yokawasa
Copy link
Copy Markdown
Contributor Author

@nnandan-postman Thanks for the approval! If everything looks good on your end, feel free to merge it whenever you're ready 🙏

@nnandan-postman nnandan-postman merged commit 41cc359 into Postman-Devrel:main Apr 11, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants