-
Notifications
You must be signed in to change notification settings - Fork 13
55 lines (46 loc) · 1.54 KB
/
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: Labeler
on:
pull_request_target:
types: [opened]
jobs:
label:
name: add label to new PRs
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v3
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
script: |
// Get PR description
const msg = context.payload.pull_request.title;
class AdaPullRequest {
constructor(label, column_id) {
this.label = label;
this.column_id = column_id;
}
addLabel() {
github.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: [this.label]
})
}
addToProjectBoard() {
github.projects.createCard({
column_id: this.column_id,
content_type: 'PullRequest',
content_id: context.payload.pull_request.id
})
}
}
if(msg) {
const inDevelopment = msg.includes("WIP");
if(inDevelopment) {
const developmentPullRequest = new AdaPullRequest("Needs Input", 11900772)
developmentPullRequest.addToProjectBoard();
} else {
const generalPullRequest = new AdaPullRequest("Ready for Review #1", 11900773)
generalPullRequest.addToProjectBoard();
}
}