Skip to content

Instantly share code, notes, and snippets.

@tcbyrd
Last active December 26, 2018 12:36
Show Gist options
  • Save tcbyrd/1297bbf8fd59ae8a83bf9fb7496422f7 to your computer and use it in GitHub Desktop.
Save tcbyrd/1297bbf8fd59ae8a83bf9fb7496422f7 to your computer and use it in GitHub Desktop.
Probot on Now.sh v2
{
"version": 2,
"builds": [
{ "src": "probot.js", "use": "@now/node" }
],
"env": {
"GITHUB_TOKEN": "@github-token",
"APP_ID": "@app-id",
"PRIVATE_KEY": "@private-key-base64"
},
"routes": [
{ "src": "/probot/.*", "dest": "probot.js" }
]
}
const { createProbot } = require('probot')
const loadProbot = appFn => {
const probot = createProbot({
id: process.env.APP_ID,
cert: Buffer.from(process.env.PRIVATE_KEY, 'base64')
})
probot.load(appFn)
return probot
}
const appFn = (app) => {
const router = app.route('/probot')
router.get('/test', (req, res) => {
res.send('hi from probot!!!')
})
}
module.exports = (req, res) => {
const probot = loadProbot(appFn)
return probot.server(req, res)
}
@tizmagik
Copy link

tizmagik commented Dec 4, 2018

Note, I had to explicitly add:

  const probot = createProbot({
    id: process.env.APP_ID,
+   secret: process.env.GITHUB_TOKEN,
    cert: Buffer.from(process.env.PRIVATE_KEY, 'base64')
  })

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment