mirror of
https://github.com/Comfy-Org/github-workflows.git
synced 2026-11-05 00:17:37 +00:00
[PR #12] [MERGED] cursor-review: skip fork PRs; degrade to job summary on read-only token #25
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#25
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/12
Author: @mattmillerai
Created: 6/22/2026
Status: ✅ Merged
Merged: 6/22/2026
Merged by: @mattmillerai
Base:
main← Head:fix/cursor-review-fork-pr-403📝 Commits (1)
eebcd8aSkip cursor-review on fork PRs; degrade to job summary on read-only token📊 Changes
2 files changed (+112 additions, -20 deletions)
View changed files
📝
.github/cursor-review/post-review.py(+97 -20)📝
.github/workflows/cursor-review.yml(+15 -0)📄 Description
What
Two complementary fixes so cursor-review stops failing red on PRs it fundamentally can't review.
Why
A fork PR (Comfy-Desktop#973) failed the
cursor-reviewcheck. Tracing it:adversarial (gemini-3.1-pro)) actually passed — every panel cell did.Consolidate panel → Post review:Root cause: on a PR from a fork, the
pull_requestevent gives the workflow no secrets and a read-onlyGITHUB_TOKEN. So:CURSOR_API_KEYis empty →cursor-agenterrorsAuthentication requiredon all 8 cells → every cell produces empty output → judge skipped → "no findings".The review can neither analyze nor post on a fork PR, yet it still ran the full 8-cell matrix + judge and failed the check on every external contribution.
Changes
1. Gate — skip fork PRs (
cursor-review.yml)Skip when
head.repo.full_name != github.repository(the cross-repo signal, ==isCrossRepository). No wasted matrix, no red X — the check is simply skipped, the standard outcome for a workflow that needs secrets a fork PR can't have.2.
post-review.py— degrade to job summary on a read-only-token 403 (defense-in-depth)If a review POST fails with
Resource not accessible by integration/HTTP 403, render the review into the job step summary and exit 0 instead of failing. Covers same-repo runs that can still hit a read-only token (read-only default workflow permissions, token-downgrading events). Genuine non-permission failures (e.g. HTTP 422) still exit 1 — no silent swallow.Testing
python3 -m py_compile post-review.pyand YAML parse — both clean.post-review.pywith a fakegh:$GITHUB_STEP_SUMMARY, exit 0 ✓Not done (and why)
pull_request_targetwould grant a write token on fork PRs, but cursor-review checks out and runs an agent over untrusted PR code — handing that a privileged token is the textbook fork-PR footgun. The proper "review forks too" path is a separateworkflow_runjob that posts from base-repo context; out of scope here.🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.