Skip to content

pr-triage: readiness step gets HTTP 403 on check runs in a private repository #227

Closed

Description

@frostyard-machines

The readiness step of .github/workflows/pr-triage.yml (at c996ea3fb54bcf1a3c621113522213702a7673e2, the same job permissions on main 17c84bf8b91e) fails in a private repository when ready-for-human is added.

Evidence: bketelsen/fleet (private) run 42646228960, PR bketelsen/fleet#140, event labeled:

pr-triage: readiness: action "labeled"
pr-triage: readiness: head "3cae24b2b6678f266a9062dc1f6d3131aedf0007"
##[error]GitHub API GET /repos/bketelsen/fleet/commits/3cae24b2b6678f266a9062dc1f6d3131aedf0007/check-runs failed: HTTP 403

The job token lists Contents: read, Metadata: read, PullRequests: write. The same step passes in frostyard/core (public) with the same permissions, for example run 42637310694 (checks counted 3, The label stays).

Possible cause: in a private repository the GITHUB_TOKEN needs checks: read for GET commits/{sha}/check-runs (and statuses: read for GET commits/{sha}/status); a public repository allows these reads without it.

Effect: every private repository with the caller gets a red pr-triage check on each ready-for-human label, and the readiness check does not run there (the step fails before any write, so it removes nothing). Known private callers: bketelsen/fleet, frostyard/apt-publisher.

Possible fix: add checks: read and statuses: read to the pr-triage job permissions in pr-triage.yml (and in docs/specs/pr-triage.md), and to the job permissions of each caller, since a called workflow cannot get more than its caller grants. A test that pins the job permissions would guard it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions