-
Notifications
You must be signed in to change notification settings - Fork 235
42 lines (34 loc) · 1.41 KB
/
Reviewer.yml
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
39
40
41
42
name: Auto Assign Reviewer and Add Labels
on:
pull_request:
types: [opened]
jobs:
assign-reviewer-and-labels:
runs-on: ubuntu-latest
steps:
- name: Assign Reviewer
run: |
# Define the reviewer(s)
REVIEWER="${{ secrets.REVIEWER_USERNAME }}"
# Get the pull request number
PR_NUMBER=$(jq --raw-output .number "$GITHUB_EVENT_PATH")
# Assign reviewer to the pull request
curl -X POST \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
-d "{\"reviewers\":[\"$REVIEWER\"]}" \
"https://api.github.com/repos/${{ github.repository }}/pulls/$PR_NUMBER/requested_reviewers"
- name: Add Labels
run: |
# Define the labels to add
LABELS='["enhancement", "GSSoc"]' # Adding GSSoc label
# Get the pull request number
PR_NUMBER=$(jq --raw-output .number "$GITHUB_EVENT_PATH")
# Add labels to the pull request
for label in $LABELS; do
curl -X POST \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
-d "{\"labels\":[\"$label\"]}" \
"https://api.github.com/repos/${{ github.repository }}/issues/$PR_NUMBER/labels"
done