Every app can either be deployed stand-alone, or combined with other apps in one deployment.
Heads up! Note that mostapps in the @probot organization have an official hosted app that you can use for your open source project. Use the hosted instance if you don't want to deploy your own.
Contents:
Every deployment will need aGitHub App registration.
Register a new GitHub App with:
https://example.com/ for now, we'll come back in a minute to update this with the URL of your deployed app.openssl rand -base64 32) and save it because you'll need it in a minute to configure your Probot app.Download the private key from the app.
Make sure that you click the greenInstall button on the top left of the app page. This gives you an option of installing the app on all or a subset of your repositories.
To deploy an app to any cloud provider, you will need 3 environment variables:
APP_ID: the ID of the app, which you can get from theapp settings page.WEBHOOK_SECRET: theWebhook Secret that you generated when you created the app.And one of:
PRIVATE_KEY: the contents of the private key you downloaded after creating the app, OR...PRIVATE_KEY_PATH: the path to a private key file.PRIVATE_KEY takes precedence overPRIVATE_KEY_PATH.
Probot can run your app function using theprobot binary. If your app function lives in./app.js, you can start it as node process usingprobot run ./app.js
Probot runs likeany other Node app on Heroku. Aftercreating the GitHub App:
Make sure you have theHeroku CLI client installed.
Clone the app that you want to deploy. e.g.git clone https://github.com/probot/stale
Create the Heroku app with theheroku create command:
$ heroku create
Creating arcane-lowlands-8408... done, stack is cedar
http://arcane-lowlands-8408.herokuapp.com/ |git@heroku.com:arcane-lowlands-8408.git
Git remote heroku added
Go back to yourapp settings page and update theWebhook URL to the URL of your deployment, e.g.http://arcane-lowlands-8408.herokuapp.com/api/github/webhooks.
Configure the Heroku app, replacing theAPP_ID andWEBHOOK_SECRET with the values for those variables, and setting the path for thePRIVATE_KEY:
$ heroku config:set APP_ID=aaa
WEBHOOK_SECRET=bbb
PRIVATE_KEY="$(cat ~/Downloads/*.private-key.pem)"
Deploy the app to heroku withgit push:
$ git push heroku main
...
-----> Node.js app detected
...
-----> Launching... done
http://arcane-lowlands-8408.herokuapp.com deployed to Heroku
Your app should be up and running! To verify that your app
is receiving webhook data, you can tail your app's logs:
$ heroku config:set LOG_LEVEL=trace
$ heroku logs --tail
Probot runs like any other Node app onRender. Aftercreating the GitHub App:
Sign up atRender and access your dashboard.
Click "New Web Service" and select your GitHub repository.
Set the "Build Command" and "Start Command". For a typical Probot app, use:
Build Command: npm install
Start Command: npm start
Set the Instance Type to "Free" or any other type you prefer.
Set environment variables:
APP_ID=aaa
WEBHOOK_SECRET=bbb
PRIVATE_KEY=
PORT=3000
PORT=3000 because Render's default port is 10000, but Probot expects 3000.PRIVATE_KEY, paste the contents of your private key directly.Deploy the app by clicking the Deploy Web Service button. Render will automatically build and start your service.
Go back to yourapp settings page and update theWebhook URL to the URL of your Render deployment, including the default webhook path, e.g.https://your-app.onrender.com/api/github/webhooks.
Your app should be up and running! To verify that your app is receiving webhook data, check the "Logs" tab in the Render dashboard.
When deploying your Probot app to a serverless/function environment, you don't need to worry about handling the http webhook requests coming from GitHub, the platform takes care of that. In many cases you can usecreateNodeMiddleware directly, e.g. for Vercel or Google Cloud Function.
import{ Probot, createProbot}from"probot";import{ createMyMiddleware}from"my-probot-middleware";import myAppfrom"./my-app.js";exportdefaultcreateMyMiddleware(myApp,{probot:createProbot()});For other environments such as AWS Lambda, Netlify Functions or GitHub Actions, you can use one ofProbot's adapters.
// handler.jsimport{ createLambdaFunction, createProbot,}from"@probot/adapter-aws-lambda-serverless";import appFnfrom"./app.js";exportconst webhooks=createLambdaFunction(appFn,{probot:createProbot(),});Learn more
Examples
Please add yours!
// ProbotFunction/index.jsimport{ createProbot, createAzureFunction,}from"@probot/adapter-azure-functions";import appfrom"../app.js";exportdefaultcreateAzureFunction(app,{probot:createProbot()});Learn more
Examples
Please add yours!
// function.jsimport{ createNodeMiddleware, createProbot}from"probot";import appfrom"./app.js";const middleware=awaitcreateNodeMiddleware(app,{probot:createProbot(),webhooksPath:"/",});exports.probotApp=(req, res)=>{middleware(req, res,()=>{ res.writeHead(404); res.end();});};Examples
Please add yours!
import{ run}from"@probot/adapter-github-actions";import appfrom"./app.js";run(app);Learn more
Examples
Please add yours!
// api/github/webhooks/index.jsimport{ createNodeMiddleware, createProbot}from"probot";import appfrom"../../../app.js";exportdefaultawaitcreateNodeMiddleware(app,{probot:createProbot(),webhooksPath:"/api/github/webhooks",});Important: SetNODEJS_HELPERS environment variable to0 in order to prevent Vercel from parsing the response body.
SeeDisable Helpers for detail.
Examples
Please add yours!
Netlify Functions are deployed on AWS by Netlify itself. So we can use@probot/adapter-aws-lambda-serverless adapter for Netlify Functions as well.
// functions/index.jsimport{ createLambdaFunction, createProbot,}from"@probot/adapter-aws-lambda-serverless";import appFnfrom"../src/app";exportconst handler=createLambdaFunction(appFn,{probot:createProbot(),});The Probot website includes a list offeatured apps. Consideradding your app to the website so others can discover and use it.
To deploy multiple apps in one instance, create a new app that has the existing apps listed as dependencies inpackage.json:
{"name":"my-probot-app","private":true,"dependencies":{"probot-autoresponder":"probot/autoresponder","probot-settings":"probot/settings"},"scripts":{"start":"probot run"},"probot":{"apps":["probot-autoresponder","probot-settings"]}}Note that this feature is only supported whenrun as Node app. For serverless/function deployments, create a new Probot app that combines others programmatically
// app.jsimport autoresponderfrom"probot-autoresponder";import settingsfrom"probot-settings";exportdefaultasync(app, options)=>{awaitautoresponder(app, options);awaitsettings(app, options);};Probot logs messages usingpino. There is a growing number of tools that consume these logs and send them to error tracking services:https://getpino.io/#/docs/transports.
By default, Probot can send errors toSentry using its own transport@probot/pino. Set theSENTRY_DSN environment variable to enable it.
Found a mistake or want to help improve this documentation?Suggest changes on GitHub