status-github-bot/index.js

49 lines
1.5 KiB
JavaScript
Raw Normal View History

const Slack = require('./lib/slack')
module.exports = async (robot) => {
2018-01-22 13:48:57 +00:00
console.log('Yay, the app was loaded!')
if (process.env.DEBUG) {
// HACK: If we're attached to the debugger, send output to console
robot.log.error = console.log
robot.log.warn = console.log
robot.log.info = console.log
robot.log.debug = console.log
robot.log.trace = console.log
}
2018-01-22 13:48:57 +00:00
2018-02-16 20:35:49 +00:00
await setupSlack(robot)
robot['slackProfileCache'] = require('./lib/slack-profile-cache')(robot)
require('./bot_scripts/assign-new-pr-to-review')(robot)
require('./bot_scripts/assign-approved-pr-to-test')(robot)
require('./bot_scripts/assign-to-bounty-awaiting-for-approval')(robot)
require('./bot_scripts/assign-to-bounty-bug-column')(robot)
require('./bot_scripts/greet-new-contributor')(robot)
require('./bot_scripts/trigger-automation-test-build')(robot)
2018-02-14 23:57:46 +00:00
require('./bot_scripts/bounty-awaiting-approval-slack-ping')(robot)
require('./bot_scripts/notify-reviewers-via-slack')(robot)
2018-01-22 13:48:57 +00:00
// For more information on building apps:
// https://probot.github.io/docs/
// To get your app running against GitHub, see:
// https://probot.github.io/docs/development/
}
2018-02-16 20:35:49 +00:00
async function setupSlack (robot) {
2018-02-22 20:58:54 +00:00
Slack.setup(robot, slack => {})
2018-02-16 20:35:49 +00:00
await new Promise(resolve => {
robot.on('slack.connected', event => {
robot.log.info(`Connected to Slack`)
// Copy Slack RTM and Slack Web clients to the robot object
robot['slack'] = event.payload.slack
robot['slackWeb'] = event.payload.slackWeb
resolve()
})
})
}