probot-serverless-now
probot-serverless-now copied to clipboard
🤖 Probot Wrapper to run GitHub Apps as Lambdas in Zeit's Now 2.0
Goal
probot-serverless-now is a wrapper around Probot to run your GitHub Apps as Serverless Functions with ZEIT Now.
Note: This package is not maintained anymore as GitHub Actions and github-app-token can, most of the time, replace Probot.
Usage
-
app.jsmodule.exports = app => { app.on("issues.opened", async context => { // A new issue was opened, what should we do with it? context.log(context.payload); }); }; -
api/index.jsconst { toLambda } = require("probot-serverless-now"); const applicationFunction = require("../app"); module.exports = toLambda(applicationFunction); -
now.json{ "version": 2, "env": { "APP_ID": "@my-app-id", "PRIVATE_KEY": "@my-app-base64-encoded-private-key", "WEBHOOK_SECRET": "@my-app-webhook-secret" } }
Supported Probot Features
- [x] Logging
- [x] Sentry integration
- [x] Webhook signature verification
- [ ] Loading the private key from the filesystem.
The
PRIVATE_KEYenvironment variable should be used instead (possibly base64 encoded). - [ ] Custom routing. The only routes are:
GET /: typical Probot landing pagePOST /: webhook handler
- [ ] Multiple applications running under the same Probot instance.
Instead, you should create multiple Now Lambdas.
Each lambda should have its own
now.jsonfile since they won't share the sameAPP_ID,PRIVATE_KEY, andWEBHOOK_SECRETenvironment variables. To do that, you could either use multiple repositories or a mono-repo with Yarn workspaces or Lerna for instance.