-
Notifications
You must be signed in to change notification settings - Fork 137
39 lines (36 loc) · 1.36 KB
/
auto-label.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
name: Auto-label when user responds
permissions:
issues: write
on:
issue_comment:
types: [created]
env:
TRIAGERS: '["int19h","karthiknadig","ericsnowcurrently","fabioz", "gramster", "StellaHuang95", "AdamYoblick"]'
jobs:
run-check:
runs-on: ubuntu-latest
if: contains(github.event.issue.labels.*.name, 'waiting for response') && !contains(github.event.issue.labels.*.name, 'user responded')
steps:
- name: Add/Remove labels when user responds
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const payload = context.payload;
const commentAuthor = payload.comment.user.login;
const isTeamMember = ${{ env.TRIAGERS }}.includes(commentAuthor);
if (!isTeamMember) {
const issue_number = payload.issue.number;
await github.rest.issues.removeLabel({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue_number,
name: 'waiting for response'
});
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue_number,
labels: ['user responded']
});
}