Skip to content

ci: run readme-pr-check on pull_request_target so fork PRs can be labeled - #4739

Merged
olaservo merged 1 commit into
modelcontextprotocol:mainfrom
olaservo:fix/readme-check-fork-permissions
Sep 2, 2026
Merged

ci: run readme-pr-check on pull_request_target so fork PRs can be labeled#4739
olaservo merged 1 commit into
modelcontextprotocol:mainfrom
olaservo:fix/readme-check-fork-permissions

Conversation

@olaservo

@olaservo olaservo commented Sep 2, 2026

Copy link
Copy Markdown
Member

Description

The check-readme-only job fails with 403 Resource not accessible by integration on the addLabels call for README-only PRs from forks (observed on #4714 and #4726, run 33362192371). The pull_request event gives fork PRs a read-only GITHUB_TOKEN, so the declared pull-requests: write permission 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. The issue_comment-triggered handle-confirmation job is unchanged.

Type of Change

  • Bug fix (CI workflow)

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_target runs the base-branch version), so the next fork README-only PR will exercise it.

🤖 Generated with Claude Code

https://claude.ai/code/session_01CK8vvB229h6orvkokG8YxU

…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
Copilot AI balanced review requested due to automatic review settings September 2, 2026 02:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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_target for 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.

@olaservo
olaservo merged commit 2e3e4c7 into modelcontextprotocol:main Sep 2, 2026
16 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