-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathindex.js
48 lines (41 loc) · 1.03 KB
/
index.js
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
const { Toolkit } = require('actions-toolkit');
const { automention } = require('./automention');
Toolkit.run(async tools => {
const {
github: { issues },
context: { issue: contextIssue },
log,
exit
} = tools;
log.info('Automention!');
try {
const config = tools.config('.github/automention.yml');
if (!config) {
throw new Error('No automention.yml');
}
const { number, owner, repo } = contextIssue;
const issue = { issue_number: number, owner, repo };
const fullIssue = (await issues.get(issue)).data;
const labels = (await issues.listLabelsOnIssue(issue)).data.map(
l => l.name
);
// FIXME: support pagination
const issueComments = (await issues.listComments({
...issue,
per_page: 100
})).data;
await automention({
issue,
fullIssue,
labels,
issueComments,
issuesApi: issues,
config,
log
});
exit.success('We did it!');
} catch (err) {
log.error(err.message);
exit.failure(err.message);
}
});