mirror of
https://github.com/Comfy-Org/github-workflows.git
synced 2026-11-05 00:17:37 +00:00
[PR #112] [MERGED] fix(pr-risk): grant the token permissions the grade job actually needs #121
Labels
No labels
cursor-review-catalog-drift
groom
groom
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Comfy-Org/github-workflows#121
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Comfy-Org/github-workflows/pull/112
Author: @mattmillerai
Created: 8/3/2026
Status: ✅ Merged
Merged: 8/3/2026
Merged by: @mattmillerai
Base:
main← Head:matt/pr-risk-token-permissions📝 Commits (2)
4914cd6fix(pr-risk): grant the token permissions the grade job actually needs2bb77fafix(pr-risk): document the full caller grant + surface why a token failure failed📊 Changes
6 files changed (+164 additions, -23 deletions)
View changed files
📝
.github/workflows/pr-risk.yml(+36 -7)📝
README.md(+1 -1)📝
scripts/pr-risk/apply-risk-label.sh(+31 -11)📝
scripts/pr-risk/grade-pr-risk.sh(+37 -4)📝
scripts/pr-risk/tests/test_apply_risk_label.sh(+29 -0)📝
scripts/pr-risk/tests/test_grade_pr_risk.sh(+30 -0)📄 Description
ELI5
The risk grader shipped asking for a key ring that opens the wrong doors: it could write on issues but not on pull requests (which is where its one label actually goes), and it couldn't look at the workflow-runs shelf its own self-exclusion trick reads from. First real run: it couldn't read the PR, graded "ungraded", then couldn't even apply the "ungraded" sticker. This swaps in the two keys it actually needs — same lock-out from everything else.
Motivation
The first live consumer enrollment (comfy-cloud-mcp-server#1093) failed on both halves of the grade job in one run, which means every consumer would fail identically and the shadow pilot cannot start until this lands. The hermetic suites stub
gh, so token-permission reality was never exercisable in CI — a live consumer run was always going to be the first test of the grants, and it was.Provenance
shellcheck -xon all four scripts: clean;tests/test_grade_pr_risk.sh: 46 passed, 0 failed;tests/test_apply_risk_label.sh: 19 passed, 0 failed. Root causes read from the failing job log: "PR unreadable via the API after 4 attempt(s)" withChecks/PullRequests/Statuses: readgranted (the GraphQL query'scheckSuite -> workflowRunhop is an Actions resource), thengh: Resource not accessible by integration (HTTP 403)onPOST /repos/.../issues/1093/labels.ghby design); verification of the fix itself is the pilot PR's re-run, tracked in the test planReviewer context
Summary
actions: readadded: the rollup GraphQL walksCheckRun -> checkSuite -> workflowRun(self-exclusion keys onworkflowRun.databaseId), workflow runs are an Actions resource, and GraphQL fails the WHOLE query on one unreadable field — so the miss surfaced as "PR unreadable", not as a partial recordpull-requests: read->write: the labels endpoint is dual-mapped — labeling an issue ridesissues: write, labeling a PR ridespull-requests: write(same reasonactions/labelerrequires it);issues: writestays for the repo-siderisk:*label creation on first useGITHUB_TOKEN, which cannot firelabeledtriggers regardless of which permission bit authorized the writeTest plan
risk:*label (expected:risk:R3— it touches.github/workflows/)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.