Skip to content

Commit f5b770b

Browse files
authored
Merge pull request kentaro-m#275 from kentaro-m/add-support-for-deploying-serverless-function
Add support for deploying serverless function
2 parents ea2080b + 02fafdf commit f5b770b

File tree

7 files changed

+2708
-2018
lines changed

7 files changed

+2708
-2018
lines changed

README.md

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,42 @@ See [Contributing](#contributing) for more information about making improvements
185185

186186
## Deploy
187187

188-
### Glitch
188+
This app can be deployed in two ways:
189+
- **Node.js App**: Traditional server-based deployment (Glitch, Heroku, etc.)
190+
- **Serverless Function**: Function-as-a-Service deployment (Vercel, Netlify, etc.)
191+
192+
### Serverless Function
193+
194+
#### Vercel
195+
196+
1. [Configure a new app on GitHub](https://github.com/settings/apps/new).
197+
* For the Homepage URL, use your repository URL: `https://github.com/your-username/your-repo`
198+
* For the Webhook URL, use: `https://your-vercel-domain.vercel.app/api/github/webhooks`
199+
* Generate a Webhook Secret with `openssl rand -base64 32` and save it
200+
* On the **Permissions & webhooks** tab, add read/write permissions for pull requests
201+
* On the **Permissions & webhooks** tab, subscribe to **Pull request** events
202+
* Save your changes and download the private key
203+
204+
2. Deploy to Vercel:
205+
* Connect your GitHub repository to Vercel
206+
* Set the following environment variables in Vercel dashboard:
207+
```
208+
APP_ID=your_github_app_id
209+
WEBHOOK_SECRET=your_webhook_secret
210+
PRIVATE_KEY=your_private_key_content
211+
```
212+
* Deploy the app
213+
214+
3. Install the GitHub App:
215+
* Go to your GitHub App settings
216+
* Click the **Install** tab
217+
* Install the app to your repositories
218+
219+
The serverless function will automatically handle GitHub webhook events at `/api/github/webhooks`.
220+
221+
### Node.js App
222+
223+
#### Glitch
189224
190225
[![Remix on Glitch](https://cdn.glitch.com/2703baf2-b643-4da7-ab91-7ee2a2d00b5b%2Fremix-button.svg)](https://glitch.com/edit/#!/import/github/kentaro-m/auto-assign)
191226

api/github/webhooks/index.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// eslint-disable-next-line @typescript-eslint/no-var-requires
2+
const { createNodeMiddleware, createProbot } = require('probot')
3+
// eslint-disable-next-line @typescript-eslint/no-var-requires
4+
const app = require('../../../lib/index.js')
5+
6+
module.exports = createNodeMiddleware(app, {
7+
probot: createProbot(),
8+
webhooksPath: '/api/github/webhooks',
9+
})

0 commit comments

Comments
 (0)