-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
35 lines (28 loc) · 906 Bytes
/
app.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
/**
* @param {import('probot').Probot} app
*/
const { Octokit } = require("@octokit/core")
const { createAppAuth } = require("@octokit/auth-app")
const mapRepos = require("./utils/mapRepos")
const onPush = require("./utils/onPush")
require("dotenv").config()
module.exports = async (app, { getRouter }) => {
const installationOctokit = new Octokit({
authStrategy: createAppAuth,
auth: {
appId: process.env.APP_ID,
privateKey: process.env.PRIVATE_KEY,
installationId: 33254077
}
})
global.octokit = installationOctokit
global.maps = {}
global.app = app
app.log("Yay! The app was loaded!")
const prompt = require("prompt-sync")({ sigint: true })
const repoNames = prompt(
"Enter the repos to be mapped (space seperated): "
).split(" ")
await mapRepos(repoNames)
app.on("push", onPush)
}