-
Notifications
You must be signed in to change notification settings - Fork 124
56 lines (54 loc) · 1.78 KB
/
team-labeler.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
43
44
45
46
47
48
49
50
51
52
53
54
55
name: "Label issues"
on:
pull_request_target:
types:
- opened
jobs:
label-pr:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
if: github.repository == 'splunk/public-o11y-docs' && github.actor != 'srv-rpa-o11y-docs-splunk'
steps:
- id: membership_check
uses: actions/github-script@v6
with:
github-token: ${{ secrets.TEAM_MEMBERSHIP_CHECK }}
script: |
try {
await github.rest.teams.getMembershipForUserInOrg({
org: 'splunk',
team_slug: 'o11y-docs',
username: context.payload.sender.login
});
console.log("Author of the PR is a maintainer")
return true
} catch (err) {
console.log("Author of the PR is not a maintainer")
return false
}
- id: labelTeam
if: steps.membership_check.outputs.result == 'true'
uses: actions/github-script@v6
with:
github-token: ${{ secrets.MY_TOKEN }}
script: |
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['internal']
})
- id: labelContributor
if: steps.membership_check.outputs.result == 'false'
uses: actions/github-script@v6
with:
github-token: ${{ secrets.MY_TOKEN }}
script: |
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['external']
})