Skip to content

probot/example-netlify-functions

Repository files navigation

Probot & Netlify Functions example

Netlify Status

This repository is an example of how to deploy the "Hello, World" of probot apps to Netlify Functions.

Local setup

Install dependencies

npm install

Start the server

npm start

Follow the instructions to register a new GitHub app.

Run the netlify function locally

You need to run npm start at least once in order to register a new GitHub App for your local testing. It will create a .env file with your app's credentials once it's done.

Install the Netlify Dev CLI

npm install --global netlify-cli

Then start it the root folder of this repository

netlify dev

In a new terminal app, start smee-client in order to receive webhook event requests from GitHub

npx smee --url [WEBHOOK_PROXY_URL] --target http://127.0.0.1:8888/.netlify/functions/webhooks

Replace WEBHOOK_PROXY_URL with the value of WEBHOOK_PROXY_URL in your .env file.

Deployment

  1. Make sure you registered your GitHub App
  2. Fork this repository
  3. Sign in to your Netlify account, follow instructions at https://app.netlify.com/start
  4. In your GitHub App's settings, update the webhook URL to the netlify domain, e.g. https://my-probot-app.netlify.app/.netlify/functions/webhooks
  5. Add environment variabbles in your Netlify's app's site settings ("Build & deploy" -> "Environment"): APP_ID, PRIVATE_KEY (replace line breaks with \n), WEBHOOK_SECRET
  6. Trigger a deploy so that the new environment variables take effect.

License

ISC