-
-
Notifications
You must be signed in to change notification settings - Fork 0
43 lines (39 loc) · 1.23 KB
/
auto-tag-issues-and-prs.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
name: Auto Label Issues and PRs
on:
pull_request:
types: [opened, reopened]
issues:
types: [opened, reopened]
jobs:
auto-label:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Auto label new issue or PR
uses: actions/[email protected]
with:
script: |
const labels = [
'needs more nothing',
'yaasification required',
'procrastinate on this',
'easy does it',
'all in good time',
'todo next year',
'later maybe',
'save for later',
'give to future intern',
'no rush',
'needs fewer details',
'monitor complexity'
];
const isIssue = !!context.payload.issue;
const number = isIssue ? context.payload.issue.number : context.payload.pull_request.number;
const randomLabel = labels[Math.floor(Math.random() * labels.length)];
github.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: number,
labels: [randomLabel]
})