You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
checkout_pr_branch: same-repository bot exception does not cover pull_request ready_for_review (or reopened) #69311
The runtime trust check in actions/setup/js/checkout_pr_branch.cjs skips the collaborator permission lookup for a Bot sender on a same-repository PR, but only for the pull_request actions opened and synchronize. For any other action, including ready_for_review, a GitHub App sender falls through to getCollaboratorPermissionLevel. That endpoint returns none for apps, so the "Checkout PR branch" step fails.
Why it matters
Review workflows commonly skip drafts (if: github.event.pull_request.draft == false) and trigger on types: [opened, synchronize, ready_for_review]. When an agent or App opens a PR as a draft and the same App later marks it ready, opened fires while the PR is still a draft and is skipped. ready_for_review is then the only event that starts the review, and that run always fails at "Checkout PR branch".
Reproduction
A workflow with on.pull_request.types: [opened, synchronize, ready_for_review], a draft guard as above, and the generated "Checkout PR branch" step in the agent job. The App is listed in on.bots.
A GitHub App opens a same-repository PR as a draft, then marks it ready for review.
The agent job fails at "Checkout PR branch":
ERR_PERMISSION: Refusing PR checkout: actor 'example-app[bot]' has 'none' permission (requires write or higher)
Observed with the setup action at v0.91.10. The condition is unchanged on main.
Cause
Current code:
if((context.eventName==="pull_request"||context.eventName==="pull_request_target")&&(context.payload.action==="opened"||context.payload.action==="synchronize")&&senderType==="Bot"&&context.payload.sender?.login===actor&&
... headandbaserepositoryidsequaltheruntimerepositoryid){core.info(`Runtime safety check passed for same-repository bot PR actor '${actor}'`);returnundefined;}
The comment above it says apps are not collaborators, which is the reason for the exception. The action list is narrower than the set of PR events a workflow can be triggered on.
Suggested fix
Add ready_for_review and reopened to the action list. The head/base repository id equality still restricts the exception to same-repository PRs. An actor that can change the draft state of a PR already needs write access to it (or must be its author), so the exception does not widen trust in a meaningful way. Please add test cases for both actions.
Related: #64788 and #67155 (both closed) describe the same "app actor gets none" behavior on other events.
Activity