|
2 | 2 |
|
3 | 3 | This repository is an example of how to deploy the "Hello, World" of probot apps to [Vercel](https://vercel.com).
|
4 | 4 |
|
5 |
| -## Local setup |
| 5 | +## Create the GiHub App |
6 | 6 |
|
7 |
| -Install dependencies |
| 7 | +We will first start by running the app localy in order to create the GitHub App and initialize the environment variables. |
8 | 8 |
|
| 9 | +1. Install dependencies |
9 | 10 | ```
|
10 | 11 | npm install
|
11 | 12 | ```
|
12 | 13 |
|
13 |
| -Start the server |
| 14 | +2. Start the server |
| 15 | +``` |
| 16 | +npm start |
| 17 | +``` |
| 18 | + |
| 19 | +3. Go to http://localhost:3000/, click `Register GitHub App` and select the app name of your choice. |
| 20 | + |
| 21 | +4. Select the repository (or organization) where your GitHub App will be installed. _It can be completly different from the GitHub App repo_ |
| 22 | + |
| 23 | +Well done! Your GitHub app has been created but is not running yet. You can close the process with `Ctrl+C` in your terminal. |
| 24 | +Note that a file called `.env` has been created. It contains all the necessary informations to run your app localy or remotely. |
14 | 25 |
|
| 26 | +## Run localy |
| 27 | + |
| 28 | +If you want to run your GitHub App localy, you can use |
15 | 29 | ```
|
16 | 30 | npm start
|
17 | 31 | ```
|
18 | 32 |
|
19 |
| -Follow the instructions to register a new GitHub app. |
| 33 | +## Deploy on Vercel |
| 34 | + |
| 35 | +In this section, we will continuously deployed your GitHub App using [Vercel](https://vercel.com). |
| 36 | + |
| 37 | +1. On your vercel Dashboard, create a new a project. |
| 38 | + |
| 39 | +2. Select your GitHub App's repository. |
| 40 | + |
| 41 | +3. Select a project name and expand the `Environment Variables` view. |
| 42 | + |
| 43 | +4. Open the file `.env` and copy all the variables to Vercel Environment Variables. |
20 | 44 |
|
21 |
| -## Deployment |
| 45 | +5. Hit deploy ! |
22 | 46 |
|
23 |
| -The app is continuously deployed using [Vercel's GitHub app](https://github.com/apps/vercel). |
| 47 | +Your app is now running on Vercel but it is not listening to the correct Webhook url. |
24 | 48 |
|
25 |
| -### Considerations |
26 |
| -- Make sure you configure [the environment variables for your GitHub App](https://probot.github.io/docs/configuration/) in Vercel. You can read more about how to do it in [their docs](https://vercel.com/docs/concepts/projects/environment-variables). |
27 |
| -- Vercel [expects to find your lambda functions under `/api` folder]([url](https://vercel.com/docs/concepts/functions/serverless-functions#deploying-serverless-functions)). Make sure your functions are placed there and double check Vercel detected your Lambda Functions during the deployment process by checking the logs: |
| 49 | +6. Go to your [GitHub App page](https://github.com/settings/apps) and `Edit` your app. |
28 | 50 |
|
29 |
| - |
| 51 | +7. Replace the `Webhook URL` with `https://<my-vercel-project-name>.vercel.app/api/github/webhooks`. |
30 | 52 |
|
31 |
| -## How it works |
| 53 | +8. Save |
32 | 54 |
|
33 |
| -The [api/github/webhooks/index.js](api/github/webhooks/index.js) file is handling requests to `POST /api/github/webhooks`, make sure to configure your GitHub App registration's webhook URL accordingly. |
| 55 | +Your GitHub App is now configured to send webhooks to your Vercel app. The [api/github/webhooks/index.js](api/github/webhooks/index.js) file is handling requests to `POST /api/github/webhooks`. You can now open an issue on the repo where your app is installed. |
34 | 56 |
|
35 | 57 | ## Other examples[^1]
|
36 | 58 | - [Using TypeScript + Vercel](https://github.com/oscard0m/example-vercel-ts) by [@oscard0m](https://github.com/oscard0m)
|
|
0 commit comments