This repository has been archived by the owner on Feb 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
75 lines (63 loc) · 3.73 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
66
67
68
69
70
71
72
73
74
75
const probotScheduler = require('probot-scheduler')
const probotCommands = require('probot-commands')
const assignHandler = require('./lib/assigner/assignHandler')
const deleteBranch = require('./lib/delete-merged-branch/delete-merged-branch')
const staleUnmark = require('./lib/stale/unmark')
const staleMarkAndSweep = require('./lib/stale/mark-and-sweep')
const todoPullRequestHandler = require('./lib/todo/pull-request-handler')
const todoPullRequestMergedHandler = require('./lib/todo/pull-request-merged-handler')
const todoPushHandler = require('./lib/todo/push-handler')
const todoIssueRenameHandler = require('./lib/todo/issue-rename-handler')
const todoIgnoreRepos = require('./lib/todo/ignore-repos')
const reminder = require('./lib/reminder/reminders')
const respondHandler = require('./lib/responder/respondHandler')
const triageHandler = require('./lib/triage/triageHandler')
const triageCheck = require('./lib/triage/check')
const unfurlHandler = require('./lib/unfurl/unfurlHandler')
module.exports = app => {
app.log.warn('StarryCake Loaded')
const appScheduler = probotScheduler(app, { interval: 30 * 60 * 1000 })
// ASSIGNER
app.on(['issues.opened','pull_request.opened'], assignHandler)
// DELETE-MERGED-BRANCH
app.on('pull_request.closed', deleteBranch)
// REMINDER
probotCommands(app, 'remind', reminder.set)
app.on('schedule.repository', reminder.check)
// STALE
app.on(['issue_comment', 'issues', 'pull_request', 'pull_request_review', 'pull_request_review_comment'], async context => {
await staleUnmark(context, app, appScheduler)
})
app.on('schedule.repository', async context => {
await staleMarkAndSweep(context, app, appScheduler)
})
// TO-DO
app.on(['pull_request.opened', 'pull_request.synchronize'], todoIgnoreRepos(todoPullRequestHandler))
app.on('pull_request.closed', todoIgnoreRepos(todoPullRequestMergedHandler))
app.on('push', todoIgnoreRepos(todoPushHandler))
app.on('issues.edited', todoIgnoreRepos(todoIssueRenameHandler))
// TRIAGE
app.on(['issues.opened','issues.reopened','pull_request.opened','pull_request.reopened'], triageHandler)
app.on(['issues.labeled','pull_request.labeled'], triageCheck)
// RESPOND
app.on(['issues.opened','issues.reopened','pull_request.opened','pull_request.reopened'], respondHandler)
// UNFURL
app.on(['issues.opened','issue_comment.created','pull_request.opened'], unfurlHandler)
// LOGGING
app.on('issues', async (context) => { app.log.warn('issues') })
app.on('issues.opened', async (context) => { app.log.warn('issues.opened') })
app.on('issues.reopened', async (context) => { app.log.warn('issues.reopened') })
app.on('issues.edited', async (context) => { app.log.warn('issues.edited') })
app.on('issues.labeled', async (context) => { app.log.warn('issues.labeled') })
app.on('issue_comment', async (context) => { app.log.warn('issue_comment') })
app.on('issue_comment.created', async (context) => { app.log.warn('issue_comment.created') })
app.on('pull_request', async (context) => { app.log.warn('pull_request') })
app.on('pull_request.opened', async (context) => { app.log.warn('pull_request.opened') })
app.on('pull_request.reopened', async (context) => { app.log.warn('pull_request.reopened') })
app.on('pull_request.labeled', async (context) => { app.log.warn('pull_request.labeled') })
app.on('pull_request.closed', async (context) => { app.log.warn('pull_request.closed') })
app.on('pull_request_review', async (context) => { app.log.warn('pull_request_review') })
app.on('pull_request_review_comment', async (context) => { app.log.warn('pull_request_review_comment') })
app.on('push', async (context) => { app.log.warn('push') })
app.on('schedule.repository', async (context) => { app.log.warn('schedule.repository') })
}