Skip to content

checkout_pr_branch.cjs fails for Copilot-authored PRs (actor is not a user) #38134

@lpcox

Description

@lpcox

Problem

assertTrustedCheckoutRuntime() in actions/setup/js/checkout_pr_branch.cjs calls getCollaboratorPermissionLevel with context.actor, which resolves to "Copilot" for Copilot-authored PRs. Since Copilot is an app (not a regular GitHub user), the API returns 404:

GET /repos/github/gh-aw-firewall/collaborators/Copilot/permission - 404
Error: Copilot is not a user

This causes the checkout step to fail for all Copilot-authored PRs.

Failing run

https://github.com/github/gh-aw-firewall/actions/runs/27211514662/job/80359993434?pr=4586

Relevant code

actions/setup/js/checkout_pr_branch.cjs lines 132-136:

const { data: permissionData } = await github.rest.repos.getCollaboratorPermissionLevel({
  owner: context.repo.owner,
  repo: context.repo.repo,
  username: actor,
});

Suggested fix

Handle 404 from the collaborators API for bot/app actors (e.g. Copilot, dependabot[bot]), either by:

  1. Catching 404 and treating known trusted app actors as permitted
  2. Checking context.payload.sender?.type for "Bot" or "Mannequin" before calling the API

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions