Skip to content

Commit aa67395

Browse files
authored
Add workflow to request Copilot review on maintainer PRs (#1587) (#1588)
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.
1 parent 7090718 commit aa67395

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Request Copilot review
2+
3+
on:
4+
pull_request_target:
5+
types: [opened, reopened, ready_for_review]
6+
7+
permissions:
8+
pull-requests: write
9+
10+
jobs:
11+
request-copilot-review:
12+
if: >-
13+
github.event.pull_request.draft == false &&
14+
contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.pull_request.author_association)
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Request Copilot review
18+
env:
19+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20+
PR_NUMBER: ${{ github.event.pull_request.number }}
21+
REPO: ${{ github.repository }}
22+
run: |
23+
gh api \
24+
--method POST \
25+
-H "Accept: application/vnd.github+json" \
26+
"/repos/${REPO}/pulls/${PR_NUMBER}/requested_reviewers" \
27+
-f "reviewers[]=Copilot"

0 commit comments

Comments
 (0)