forked from probot/no-response
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
32 lines (25 loc) · 1.01 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
const createScheduler = require('probot-scheduler')
const NoResponse = require('./lib/no-response')
module.exports = async robot => {
// Visit all repositories to sweep issues with no response
createScheduler(robot)
robot.on('schedule.repository', sweep)
// Remove response required label if the author comments
robot.on('issue_comment', unmark)
async function sweep (context) {
const config = await context.config(`no-response-milestones.yml`)
if (config) {
const configWithDefaults = Object.assign({}, require('./lib/defaults'), config)
const noResponse = new NoResponse(context, configWithDefaults, robot.log)
return noResponse.sweep()
}
}
async function unmark (context) {
const config = await context.config('no-response.yml')
if (config) {
const configWithDefaults = Object.assign({}, require('./lib/defaults'), config)
const noResponse = new NoResponse(context, configWithDefaults, robot.log)
return noResponse.unmark(context.issue())
}
}
}