Skip to content

Fix re-request-review workflow for fork-originated PRs (privilege separation) - #10286

Open
kaovilai with Copilot wants to merge 3 commits into
mainfrom
copilot/fix-re-request-review-workflow
Open

Fix re-request-review workflow for fork-originated PRs (privilege separation)#10286
kaovilai with Copilot wants to merge 3 commits into
mainfrom
copilot/fix-re-request-review-workflow

Conversation

Copilot AI commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

For fork-originated PRs, GITHUB_TOKEN on pull_request_review events is read-only regardless of declared permissions, causing a 403 when calling github.rest.pulls.requestReviewers(). The error was also silently swallowed via core.warning().

Changes

  • auto_assign_prs.yml — replaces the failing re-request-review job with a lightweight record-pr-number job that writes the PR number to an artifact. PR number is passed via env variable (not direct expression interpolation) to prevent shell injection. Preserves existing pull_request_target auto-assignment behavior unchanged.

  • .github/workflows/re_request_review.yml (new) — privileged workflow_run workflow triggered after the above completes successfully:

    • Runs in base-repo context, receiving a write token even for fork PRs
    • Strictly validates artifact content with /^\d+$/ before use — artifact is treated as untrusted input, no PR code is checked out or executed
    • Fetches PR state and all reviews via paginated API calls; recounts approvals using same logic (sort by submitted_at, fold by user, check APPROVED)
    • Calls requestReviewers only when approval count is below threshold
    • Uses core.setFailed() on API errors — failures are no longer silent
    • Minimal permissions: actions: read + pull-requests: write

Please indicate you've done the following:

@netlify

netlify Bot commented Aug 15, 2026

Copy link
Copy Markdown

Deploy Preview for velero canceled.

Name Link
🔨 Latest commit c55559f
🔍 Latest deploy log https://app.netlify.com/projects/velero/deploys/6a7fc191e5ddce0009149de6

Copilot AI and others added 2 commits August 15, 2026 01:30
Co-authored-by: kaovilai <11228024+kaovilai@users.noreply.github.com>
Co-authored-by: kaovilai <11228024+kaovilai@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix GitHub Actions workflow to re-request maintainer review for forks Fix re-request-review workflow for fork-originated PRs (privilege separation) Aug 15, 2026
Copilot AI requested a review from kaovilai August 15, 2026 01:33
@kaovilai
kaovilai marked this pull request as ready for review August 15, 2026 01:35
@kaovilai
kaovilai requested a review from a team as a code owner August 15, 2026 01:35
@codecov

codecov Bot commented Aug 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants