-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.js
36 lines (32 loc) · 979 Bytes
/
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
module.exports = robot => {
robot.on(
[
"pull_request.opened",
"pull_request.edited",
"pull_request.synchronize",
"pull_request.reopened"
],
context => {
const title = context.payload.pull_request.title;
const body = context.payload.pull_request.body;
const isUnChecked = /-\s\[\s\]/g.test(body);
const status = isUnChecked ? "failure" : "success";
robot.log(
`Updating PR "${title}" (${context.payload.pull_request
.html_url}): ${status}`
);
robot.log(`isUnchecked: ${isUnChecked}`);
robot.log(`logging body: ${body}`);
context.octokit.repos.createCommitStatus(
context.repo({
sha: context.payload.pull_request.head.sha,
state: status,
description: isUnChecked
? "The task list is not completed yet"
: "The task list is completed",
context: "Task List Zero"
})
);
}
);
};