Skip to content

Add minimum permissions to PR label workflows - #8714

Open
Tomlu60220244 wants to merge 4 commits into
hackforla:gh-pagesfrom
Tomlu60220244:8592-test-pull-requests-write
Open

Add minimum permissions to PR label workflows#8714
Tomlu60220244 wants to merge 4 commits into
hackforla:gh-pagesfrom
Tomlu60220244:8592-test-pull-requests-write

Conversation

@Tomlu60220244

@Tomlu60220244 Tomlu60220244 commented Aug 1, 2026

Copy link
Copy Markdown
Member

Fixes #8592

What changes did you make?

Added explicit workflow-level permissions to the PR label workflows.

For .github/workflows/set-pr-labels.yaml:

  • contents: read
  • issues: read

For .github/workflows/wr-set-pr-labels.yaml:

  • contents: read
  • actions: read
  • issues: write
  • pull-requests: write

Why did you make the changes?

This limits the default GITHUB_TOKEN permissions to the minimum required access for these workflows, following GitHub Actions security best practices.

pull-requests: write is included only in .github/workflows/wr-set-pr-labels.yaml because testing confirmed that this workflow needs write access to pull requests. It was removed from .github/workflows/set-pr-labels.yaml because that workflow does not write to pull requests.

CodeQL Alerts

  • I have checked this PR for CodeQL alerts and none were found.
  • I found CodeQL alert(s), and resolved or documented them.

Screenshots of Proposed Changes To The Website

No visual changes to the website.

Testing

Testing confirmed that pull-requests: write is required for .github/workflows/wr-set-pr-labels.yaml, but it is not needed for .github/workflows/set-pr-labels.yaml.

With these permissions, each workflow has the minimum permissions needed for its behavior.

@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown

Want to review this pull request? Take a look at this documentation for a step by step guide!


From your project repository, check out a new branch and test the changes.

git checkout -b Tomlu60220244-8592-test-pull-requests-write gh-pages
git pull https://github.com/Tomlu60220244/website.git 8592-test-pull-requests-write

@github-actions github-actions Bot added role: back end/devOps Tasks for back-end developers Complexity: Large Feature: Refactor GHA Refactoring GitHub actions to fit latest architectural norms size: 8pt Can be done in 31-48 hours labels Aug 1, 2026

@t-will-gillis t-will-gillis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hey @Tomlu60220244 - Thanks for working on this! We already discussed the reason to add the pull-requests: write permission to wr-set-pr-labels.yaml in #8592. Great catch on this!

The only comments I have are:

  • please confirm that the pull-requests: write permission is needed on set-pr-labels.yaml. Since the workflow is not writing to the PR in this step it should not be needed. I tested the workflow in my repo, and unless you are seeing something different from me I don't believe this is needed.
  • very minor thing, but please check the Action Item boxes in the original issue.

Great job again!

@github-project-automation github-project-automation Bot moved this from PR Needs review to PRs being reviewed in P: HfLA Website: Project Board Aug 1, 2026
@Tomlu60220244

Copy link
Copy Markdown
Member Author

Thanks @t-will-gillis for checking this.

I’ll remove pull-requests: write from .github/workflows/set-pr-labels.yaml since that workflow does not write to the PR. I’ll keep pull-requests: write in .github/workflows/wr-set-pr-labels.yaml, where it is needed.

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

Labels

Complexity: Large Feature: Refactor GHA Refactoring GitHub actions to fit latest architectural norms role: back end/devOps Tasks for back-end developers size: 8pt Can be done in 31-48 hours

Projects

Status: PRs being reviewed

Development

Successfully merging this pull request may close these issues.

Specify default permissions for set-pr-labels.yaml and wr-set-pr-labels.yaml

2 participants