GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Remove unused 'pull-requests: read' permission from the labels workflow by yuunnn · Pull Request #28241 · PowerShell/PowerShell

Conversation

@yuunnn

@yuunnn 吴旭云 (yuunnn) commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

PR Summary

Fixes #28194.

Verify PR Labels declares pull-requests: read, but no step in the workflow needs it. The only steps are:

  • actions/checkout, which requires contents: read.
  • actions/github-script, whose inline script makes no API call. It reads context.payload.pull_request.labels, which is already part of the webhook payload the runner received. Reading it does not touch the REST API, so no permission authorises anything.

pull-requests: read would only be required if the script fetched the labels through the API instead, for example pulls.get or issues.listLabelsOnIssue. It does not, so contents: read is the minimal sufficient set.

PR Context

Removing the scope keeps the workflow working and reduces the token permissions granted to the job, in line with the principle of least privilege. The token minted for this workflow is available to every step, including the third-party actions pinned in it.

PR Checklist

  • PR has a meaningful title
  • Summarized changes
  • Make sure all .h, .cpp, .cs, .ps1 and .psm1 files have the correct copyright header
  • This PR is ready to merge.
  • Breaking changes
    • None
  • User-facing changes
    • Not Applicable
  • Testing - New and feature
    • N/A or can only be tested interactively

Validation

The change only removes a permission that is not consumed. The verify-labels job is guarded by if: github.repository_owner == 'PowerShell', so it does not run on forks; on the upstream repository it continues to evaluate context.payload.pull_request.labels exactly as before, and actions/checkout keeps the contents: read it needs.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@yuunnn
Remove unused 'pull-requests: read' from the labels workflow
36d8feb
@yuunnn
吴旭云 (yuunnn) requested review from a team and Justin Chung (jshigetomi) as code owners October 20, 2026 09:37
Copilot AI balanced review requested due to automatic review settings October 20, 2026 09:37
@azure-pipelines

azure-pipelines Bot commented Oct 20, 2026

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Copilot started reviewing on behalf of 吴旭云 (yuunnn) October 20, 2026 09:38
View session
Copilot AI reviewed Oct 20, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

🟢 Approval recommended

Label validation reads the webhook payload without API calls, and checkout retains its required permission.

No open issues 🎉

What changed in this PR

Addresses #28194 by reducing token permissions in the label-validation workflow.

Changes:

  • Removes unused pull-requests: read.
  • Retains contents: read for checkout without changing label validation.
File Description
.github/​workflows/​labels.yml Removes an unnecessary token permission.

Review effort: Balanced

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@daxian-dbw Dongbo Wang (daxian-dbw) added the CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log label Oct 23, 2026
daxian-dbw
Dongbo Wang (daxian-dbw) approved these changes Oct 23, 2026
View reviewed changes
@daxian-dbw
Dongbo Wang (daxian-dbw) merged commit c28aa00 into PowerShell:master Oct 23, 2026
36 of 37 checks passed

Uh oh!

There was an error while loading. Please reload this page.

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

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments
@daxian-dbw Dongbo Wang (daxian-dbw) daxian-dbw approved these changes
@jshigetomi Justin Chung (jshigetomi) Awaiting requested review from jshigetomi jshigetomi is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

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

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@yuunnn @daxian-dbw
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.