-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathindex.js
More file actions
72 lines (66 loc) · 2.69 KB
/
Copy pathindex.js
File metadata and controls
72 lines (66 loc) · 2.69 KB
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
module.exports = (robot) => {
robot.events.setMaxListeners(100) // Since we use multiple plugins
// Plugins that we use
require('./slack-stuff')(robot)
require('./move-to')(robot)
require('project-bot')(robot)
require('probot-settings')(robot)
// require('probot-changelog')(robot)
require('./changelog')(robot)
require('autolabeler')(robot)
require('first-pr-merge')(robot)
require('new-issue-welcome')(robot)
require('new-pr-welcome')(robot)
require('request-info')(robot)
require('unfurl')(robot)
require('todo/src')(robot)
require('release-notifier')(robot)
require('wip-bot')(robot)
require('./project-events')(robot)
console.log('Yay, the app was loaded!')
// Add a ping route
const app = robot.route('/staxly')
app.get('/_ping', (req, res) => {
res.end('Pong')
})
// // If someone submits a Pull Request check if it has a reviewer
// function getSlackUserByGithubIdOrNull (githubId) {
// return robot.slackAdapter.getBrain().users.filter(user => {
// const {fields} = user.profile
// if (fields) { // Not all users have fields
// const gitHubField = fields['Xf0MQDURNX']
// if (gitHubField) {
// return githubId === gitHubField.value
// } else {
// return false
// }
// }
// })[0]
// }
// async function notifySlackUserWhenPullRequestOpened ({payload, github}) {
// const {number, html_url: htmlUrl} = payload.pull_request
// const {name, owner: {login}} = payload.repository
// const senderLogin = payload.sender.login
// const {data: {users: reviewRequests}} = await github.pullRequests.getReviewRequests({
// owner: login,
// repo: name,
// number: number
// })
//
// const slackUser = getSlackUserByGithubIdOrNull(senderLogin)
// if (reviewRequests.length === 0) {
// if (slackUser) {
// robot.log(`Notifying ${senderLogin} that they opened a Pull Request with no reviewers`)
// await robot.slackAdapter.sendDM(slackUser.id, `I noticed you submitted a Pull Request at ${htmlUrl} but did not include any reviewers. *Consider adding a reviewer*.\n\n You can edit my code at https://github.com/openstax/staxly or create an Issue for discussion.`)
// } else {
// robot.log(`Could not find slack user with GitHub id ${senderLogin}. Ask them to update their profile`)
// }
// }
// }
// robot.on('pull_request.opened', notifySlackUserWhenPullRequestOpened)
// robot.on('pull_request.reopened', notifySlackUserWhenPullRequestOpened)
// 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/
}