2018-03-27 18:40:14 +00:00
|
|
|
// Description:
|
|
|
|
// Startup script
|
|
|
|
//
|
|
|
|
// Dependencies:
|
|
|
|
// mem-cache: "0.0.5"
|
|
|
|
// memjs: "^1.2.0"
|
|
|
|
// @slack/client: "^3.16.0"
|
|
|
|
//
|
|
|
|
// Author:
|
|
|
|
// PombeirP
|
|
|
|
|
2018-02-14 11:37:49 +00:00
|
|
|
const Slack = require('./lib/slack')
|
2018-03-27 18:40:14 +00:00
|
|
|
const memjs = require('memjs')
|
2018-02-04 18:09:13 +00:00
|
|
|
|
|
|
|
module.exports = async (robot) => {
|
2018-01-22 13:48:57 +00:00
|
|
|
console.log('Yay, the app was loaded!')
|
2018-03-28 15:58:26 +00:00
|
|
|
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-03-27 18:40:14 +00:00
|
|
|
setupMemcache(robot)
|
2018-02-16 20:35:49 +00:00
|
|
|
await setupSlack(robot)
|
2018-02-14 11:37:49 +00:00
|
|
|
|
2018-03-28 16:02:12 +00:00
|
|
|
robot['slackProfileCache'] = require('./lib/slack-profile-cache')(robot)
|
2018-02-04 18:09:13 +00:00
|
|
|
|
2018-02-05 14:33:43 +00:00
|
|
|
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)
|
2018-03-14 13:24:11 +00:00
|
|
|
require('./bot_scripts/assign-to-bounty-bug-column')(robot)
|
2018-02-05 14:33:43 +00:00
|
|
|
require('./bot_scripts/greet-new-contributor')(robot)
|
2018-02-07 16:59:55 +00:00
|
|
|
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-03-27 18:40:14 +00:00
|
|
|
require('./bot_scripts/tip-kudos-recipients')(robot)
|
2018-04-30 17:13:49 +00:00
|
|
|
require('./bot_scripts/check-bot-balance')(robot)
|
2018-07-23 05:31:43 +00:00
|
|
|
require('./bot_scripts/manage-pr-checklist')(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()
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
2018-03-27 18:40:14 +00:00
|
|
|
|
|
|
|
function setupMemcache (robot) {
|
|
|
|
// Environment variables are defined in .env
|
|
|
|
let MEMCACHE_URL = process.env.MEMCACHE_URL || '127.0.0.1:11211'
|
|
|
|
if (process.env.USE_GAE_MEMCACHE) {
|
|
|
|
MEMCACHE_URL = `${process.env.GAE_MEMCACHE_HOST}:${process.env.GAE_MEMCACHE_PORT}`
|
|
|
|
}
|
|
|
|
const mc = memjs.Client.create(MEMCACHE_URL, {
|
|
|
|
username: process.env.MEMCACHE_USERNAME,
|
|
|
|
password: process.env.MEMCACHE_PASSWORD
|
|
|
|
})
|
|
|
|
|
|
|
|
// Copy memcache client to the robot object
|
|
|
|
robot['memcache'] = mc
|
|
|
|
}
|