-
-
Notifications
You must be signed in to change notification settings - Fork 46
40 lines (35 loc) · 1022 Bytes
/
set_reviewers.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
name: Set reviewers
on:
pull_request_target:
types:
- opened
jobs:
set-reviewers:
name: Set reviewers
runs-on: ubuntu-latest
timeout-minutes: 1
steps:
- name: Set reviewers
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { owner, repo } = context.repo;
if(owner == 'dev-yakuza') {
return;
}
const prNumber = context.payload.pull_request.number;
const { data: assignedReviewers } = await github.rest.pulls.listRequestedReviewers({
owner,
repo,
pull_number: prNumber,
});
if (assignedReviewers.length == 0) {
const reviewers = [owner];
await github.rest.pulls.requestReviewers({
owner,
repo,
pull_number: prNumber,
reviewers: reviewers
});
}