Skip to content

Workflow labels.yml grants pull-requests: read that no step uses #28194

Open

Description

@Fr3ya

Prerequisites

Steps to reproduce

In .github/workflows/labels.yml

Finding

pull-requests: read has no consumer.

step demand basis
actions/checkout@3d3c42e contents: read documented requirement
actions/github-script@3a2844b none the inline script makes no API call

The script reads context.payload.pull_request.labels. The labels are already in the webhook payload the runner receives; reading them does not touch the REST API, so no permission authorises anything here. pull-requests: read would only be needed if the script called something like pulls.get or issues.listLabelsOnIssue to fetch the labels instead, it does not.

Minimal sufficient set: contents: read.

Expected behavior

The `permissions:` block lists only the scopes a step actually uses. Here that is
`contents: read`, for `actions/checkout`.

Actual behavior

pull-requests: read is also granted, and nothing consumes it. The script reads the labels out of context.payload, which is the webhook payload the runner already holds — no REST call is made, so no permission authorises it. The scope would only be needed if the labels were fetched through the API instead.

Suggested change:

 permissions:
   contents: read
-  pull-requests: read

Error details

Environment data

N/A

Visuals

No response

Activity

  1. added
    Needs-TriageThe issue is new and needs to be triaged by a work group.
    on Oct 13, 2026
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

    Needs-TriageThe issue is new and needs to be triaged by a work group.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions