-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.js
65 lines (39 loc) · 1.76 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
const createScheduler = require("probot-scheduler");
const DuplicateCheck = require("./lib/duplicate-check");
const NoInfo = require("./lib/no-info");
const IssueComment = require("./lib/issue-comment");
const NoResponse = require("./lib/no-response");
const PullRequest = require("./lib/pull-request");
module.exports = async (robot) => {
robot.log("The app was loaded!");
createScheduler(robot);
robot.on("issues.opened", async context => {
robot.log("New issue created");
//Check if the issue is a duplicate based on the title
const duplicateCheck = new DuplicateCheck(context, robot.log);
const issueIsDuplicate = await duplicateCheck.isIssueDuplicate();
//If the issue wasn't a duplicate
if (!issueIsDuplicate) {
//Check to see if the issue creator has provided any details
const noInfo = new NoInfo(context, robot.log);
await noInfo.checkForInfo();
}
});
robot.on("issue_comment", async context => {
robot.log("Issue comment");
//Re-open check: If JackettBot originally closed the issue, check to see if it should be re-opened
const issueComment = new IssueComment(context, robot.log);
await issueComment.processIssueComment();
});
robot.on("schedule.repository", async context => {
// this event is triggered on an interval, which is 1 hr by default
robot.log("Scheduled trigger");
const noResponse = new NoResponse(context, robot.log);
await noResponse.sweep();
});
robot.on("pull_request.opened", async context => {
robot.log("Pull request created");
const pullRequest = new PullRequest(context, robot.log);
await pullRequest.checkReadme();
});
};