Skip to content

Auto-request Copilot review on maintainer PRs (#1587)#1588

Merged
brendancol merged 1 commit into
mainfrom
issue-1587
May 11, 2026
Merged

Auto-request Copilot review on maintainer PRs (#1587)#1588
brendancol merged 1 commit into
mainfrom
issue-1587

Conversation

@brendancol
Copy link
Copy Markdown
Contributor

Closes #1587.

Adds .github/workflows/copilot-review.yml. It fires on pull_request_target for opened, reopened, and ready_for_review, and requests Copilot as a reviewer only when author_association is OWNER, MEMBER, or COLLABORATOR. Drafts are skipped.

pull_request_target (not pull_request) is intentional — the job needs pull-requests: write, and that token scope is denied on PRs from forks under the pull_request event. Since the workflow does not check out PR code and only calls the reviewers REST API, running in the base-repo context is safe.

Test plan

  • Open a draft PR as a maintainer → workflow runs but the job is skipped.
  • Mark draft ready for review → workflow re-runs and requests Copilot.
  • Open a PR from an outside contributor fork → workflow runs, job is skipped (no review requested).
  • Open a normal PR as a maintainer → Copilot review is requested.

Fires on pull_request_target (opened, reopened, ready_for_review) and
only requests review when author_association is OWNER, MEMBER, or
COLLABORATOR. Drafts are skipped. Uses pull_request_target so the job
has write access on fork-based PRs.
@github-actions github-actions Bot added the performance PR touches performance-sensitive code label May 11, 2026
@brendancol brendancol requested a review from Copilot May 11, 2026 14:38
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds an automation workflow to request a GitHub Copilot review on PRs authored by maintainers/collaborators, reducing the need for manual reviewer assignment while avoiding spending review budget on drive-by fork PRs.

Changes:

  • Introduces a new pull_request_target workflow triggered on opened, reopened, and ready_for_review.
  • Gates execution to non-draft PRs where author_association is OWNER, MEMBER, or COLLABORATOR.
  • Uses gh api to call the REST endpoint that requests a reviewer on the PR.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +22 to +27
run: |
gh api \
--method POST \
-H "Accept: application/vnd.github+json" \
"/repos/${REPO}/pulls/${PR_NUMBER}/requested_reviewers" \
-f "reviewers[]=Copilot"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@copilot apply changes based on this feedback

@brendancol brendancol merged commit aa67395 into main May 11, 2026
15 of 16 checks passed
Copilot stopped work on behalf of brendancol due to an error May 11, 2026 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance PR touches performance-sensitive code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Auto-request Copilot review on PRs from maintainers

2 participants