ci: run readme-pr-check on pull_request_target so fork PRs can be labeled - #4739
Merged
olaservo merged 1 commit intoSep 2, 2026
Merged
Conversation
…eled Observed on modelcontextprotocol#4714 and modelcontextprotocol#4726: addLabels returned 403 "Resource not accessible by integration" because pull_request gives fork PRs a read-only token. The job only calls the GitHub API and never checks out PR code, so pull_request_target is safe here. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CK8vvB229h6orvkokG8YxU
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The event and job condition changes resolve fork token permissions without exposing the write token to PR code.
Pull request overview
Switches the README-only PR workflow to pull_request_target, enabling labels and comments on fork PRs without executing contributor code.
Changes:
- Uses
pull_request_targetfor newly opened README PRs. - Updates the job condition and documents the security rationale.
File summaries
| File | Description |
|---|---|
.github/workflows/readme-pr-check.yml |
Enables write-token API operations for fork PRs. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
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.
Description
The
check-readme-onlyjob fails with 403Resource not accessible by integrationon theaddLabelscall for README-only PRs from forks (observed on #4714 and #4726, run 33362192371). Thepull_requestevent gives fork PRs a read-onlyGITHUB_TOKEN, so the declaredpull-requests: writepermission never takes effect and the gate comment is never posted for external contributors — the workflow's main audience.This switches the trigger to
pull_request_target, which runs with a write token. The job only calls the GitHub API (listFiles,listComments,addLabels,createComment) and never checks out or executes PR code, so the write token is safe with this event. Theissue_comment-triggeredhandle-confirmationjob is unchanged.Type of Change
How Has This Been Tested?
Reproduced the 403 in the failed run logs for #4726. The workflow change itself only takes effect once merged to
main(pull_request_targetruns the base-branch version), so the next fork README-only PR will exercise it.🤖 Generated with Claude Code
https://claude.ai/code/session_01CK8vvB229h6orvkokG8YxU