Skip to content

Grant pull-requests: write to the issue labeler workflow - #347

Merged
v-robaiken merged 1 commit into
mainfrom
robaiken/fix-labeler-pr-permission
Oct 30, 2026
Merged

v-robaiken merged 1 commit into
mainfrom
robaiken/fix-labeler-pr-permission

Conversation

@v-robaiken

Copy link
Copy Markdown
Contributor

Summary

The Issue Labeler runs on pull_request_target, but its token could only write issues. Adding a label to a pull request needs pull-requests: write, so every allowlist PR since #311 failed triage with a bare AggregateError (e.g. #346, and the castai and go.dev allowlist PRs).

 permissions:
   issues: write
+  pull-requests: write
   contents: read

Evidence

Reproduced in a scratch repo running this exact workflow (same pinned github/issue-labeler SHA and rules) against a PR titled "Allowlist …":

  • Before (issues: write only): the action fails with Could not add label(s) allowlist → AggregateError. Calling the same endpoint directly with the token shows the real error:
    POST /repos/{repo}/issues/1/labels → 403 Resource not accessible by integration
    After (+ pull-requests: write): run succeeds and the PR is labelled allowlist.

Merge Danger

Door: two-way

Revert the one line to undo it.

Blast Radius: small

Only this workflow's token gains PR write access. The workflow checks out no PR code and only runs the pinned labeler action, so the extra scope isn't reachable by fork contributors.

The labeler runs on pull_request_target, but the GITHUB_TOKEN only had
issues: write. Adding a label to a pull request with that token returns
403 "Resource not accessible by integration", which github/issue-labeler
surfaces only as a bare AggregateError. The workflow has failed on every
allowlist PR since it was added in #311.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 55098ea5-f0c8-4d32-abd9-63f14567c426
@v-robaiken
v-robaiken requested a review from a team as a code owner October 30, 2026 12:36
Copilot AI balanced review requested due to automatic review settings October 30, 2026 12:36

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are recorded for the workflow token-permission update.

No open issues 🎉

What changed in this PR

Updates the Issue Labeler workflow’s token permissions so it can apply the allowlist label to pull requests, addressing the triage failures reported since #311.

Changes:

  • Adds pull-requests: write while retaining the existing issue-write and contents-read permissions.
File Description
.github/​workflows/​issue-labeler.yml Grants the permission needed to label pull requests.

Review effort: Balanced

@jurre jurre 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.

Kind of sounds like this might be better off as a copilot cloud workflow, but this will work

@v-robaiken
v-robaiken merged commit db5a1fb into main Oct 30, 2026
200 of 216 checks passed
@v-robaiken
v-robaiken deleted the robaiken/fix-labeler-pr-permission branch October 30, 2026 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants