-
Notifications
You must be signed in to change notification settings - Fork 1.2k
38 lines (32 loc) · 1.06 KB
/
Copy pathcopilot-code-review.yml
File metadata and controls
38 lines (32 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
name: Copilot code review
on:
pull_request_target:
types:
- opened
- reopened
- synchronize
- ready_for_review
permissions:
contents: read
pull-requests: write
jobs:
request-copilot-review:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- name: Request Copilot review
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
requested_reviewers="$(gh api \
"/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/requested_reviewers")"
if echo "$requested_reviewers" | jq -e '(.users // []) | any(.login | ascii_downcase == "copilot")' >/dev/null; then
echo "Copilot review already requested, skipping."
exit 0
fi
gh api \
--method POST \
-H "Accept: application/vnd.github+json" \
"/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/requested_reviewers" \
-f reviewers[]='copilot'