Commit 2e8907e 1 parent fa7ec3a commit 2e8907e Copy full SHA for 2e8907e
File tree 3 files changed +56
-86
lines changed
3 files changed +56
-86
lines changed Original file line number Diff line number Diff line change
1
+ name : Add reviewers to PRs
2
+
3
+ on :
4
+ pull_request_target :
5
+ branches : ['master', 'next']
6
+ types : ['labeled']
7
+ workflow_call :
8
+ inputs :
9
+ team-slug :
10
+ description : ' The slug of the team from which reviewers get collected'
11
+ required : true
12
+ type : string
13
+ label-name :
14
+ description : ' The name of the label that triggers the action'
15
+ required : true
16
+ type : string
17
+ secrets :
18
+ token :
19
+ description : ' The github token to use for the API calls. You can use the GITHUB_TOKEN secret'
20
+ required : true
21
+ type : string
22
+
23
+ permissions : {}
24
+
25
+ jobs :
26
+ add-reviewers-to-pr :
27
+ # Tests that label is added on the PR
28
+ if : ${{ github.event.label.name == inputs.label-name }}
29
+ runs-on : ubuntu-latest
30
+ permissions :
31
+ contents : read
32
+ pull-requests : write
33
+ steps :
34
+ - id : get-members
35
+ run : |
36
+ DATA=$(gh api \
37
+ -H "Accept: application/vnd.github+json" \
38
+ -H "X-GitHub-Api-Version: 2022-11-28" \
39
+ /orgs/${{ github.repository_owner }}/teams/${{ inputs.team-slug }}/members?role=maintainer&per_page=100 \
40
+ | jq 'reduce inputs as $i (.; . += $i)') \
41
+ echo "data=$DATA" >> $GITHUB_OUTPUT
42
+
43
+ # assign reviewers
44
+ - id : assign-reviewers
45
+ run : |
46
+ curl -L \
47
+ -X POST \
48
+ -H "Accept: application/vnd.github+json" \
49
+ -H "Authorization: Bearer ${{ secrets.token }}" \
50
+ -H "X-GitHub-Api-Version: 2022-11-28" \
51
+ https://api.github.com/repos/${{ github.repository_owner }}/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/requested_reviewers \
52
+ -d '{"reviewers":[${{ join(fromJson(steps.get-members.outputs.data).*.login) }}]}' \
Original file line number Diff line number Diff line change 22
22
.env.test.local
23
23
.env.production.local
24
24
25
+ # IDE specific files
26
+ .idea
27
+
25
28
npm-debug.log *
26
29
yarn-debug.log *
27
30
yarn-error.log *
@@ -53,4 +56,4 @@ packages/toolpad-app/public/typings.json
53
56
packages /toolpad-app /prisma /generated
54
57
55
58
56
- .toolpad-generated
59
+ .toolpad-generated
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments