Note - I use heroku for deploying prod app and for local I use smee for proxying webhook payload to localhost.
- Deploy the probot app code to heroku.
- Create two github apps say my-app and my-app-dev.
- For my-app put the heroku url like http://my-app.herokuapp.com/ in Webhook URL.
- For my-app-dev put the smee url like https://smee.io/aldnhksfh in Webhook URL.
- For both apps use appropriate Webhook Secrets and download the private keys.
- Rename the private keys to private-key.pem and private-key-dev.pem respectively.
- In the
.env
file store the production config values (APP_ID, PRIVATE_KEY_PATH, WEBHOOK_SECRET). - For local development add these scripts in package.json and replace the config values with your my-app-dev one's.
"scripts": {
"start": "probot run ./index.js",
"start:dev": "nodemon --exec \"npm start -- -a APP_ID -P private-key-dev.pem -W https://smee.io/aldnhksfh\"",
"probot": "probot",
"test": "jest && standard"
}
- Run
npm i --save-dev nodemon
. - For local development do
npm run start:dev
- With this, nodemon will restart my-app-dev probot app if code changes.
- In heroku add the Config Vars according to the
.env
file. ForPRIVATE_KEY
use the content ofprivate-key.pem
.
- No changes in code base.
- Easy to manage.
- Easy to deploy.