This is a Next.js project bootstrapped with create-next-app.
-
Create a Supabase project at supabase.com
-
Add environment variables to
.env.local:
First, run the development server:
pnpm dev- Create a GitHub App at github.com/settings/apps/new with these permissions:
- Actions: Read & write
- Checks: Read-only
- Workflows: Read & write
- Contents: Read-only
- Metadata: Read-only
- Subscribe to these webhook events:
Required:
- Workflow job
- Workflow run
- Check run
- Workflow dispatch
- Repository dispatch
- Meta
- Generate a webhook secret:
# On macOS/Linux
openssl rand -hex 32
# On Windows with PowerShell
[Convert]::ToHexString((1..32 | ForEach-Object { [byte](Get-Random -Minimum 0 -Maximum 256) }))-
Add the generated secret to your GitHub App:
- In the "Webhook" section of your GitHub App settings
- Paste the generated secret into the "Webhook Secret" field
- Save changes
-
Add the same secret to your
.env.localfile:
GITHUB_WEBHOOK_SECRET=your_generated_secret
- Set the Webhook URL in GitHub to:
https://your-domain.com/api/github/webhook
- Next add the name of your Github app to your
.env.localfile:
GITHUB_APP_NAME=lime-test
In order to act on behalf of your GitHub app, you need to create a private key when setting up your app. You need to add this
private key to your env.local this way:
- Start with your original PEM file This is your standard private key file that looks like:
-----BEGIN RSA PRIVATE KEY-----
MIIEogIBAAKCAQEAuvhXnq...
(many lines of base64 content)
...gIt5dsqY20U/ck7CE9tJYX
-----END RSA PRIVATE KEY-----
-
Remove the headers and line breaks Extract just the content between the BEGIN and END lines, removing all line breaks:
MIIEogIBAAKCAQEAuvhXnq...gIt5dsqY20U/ck7CE9tJYX -
Base64 encode this content Use the command line to encode this content:
echo -n "MIIEogIBAAKCAQEAuvhXnq...gIt5dsqY20U/ck7CE9tJYX" | base64This will give you a single line of base64-encoded text like:
TUlJRW9nSUJBQUtDQVFFQXV2aFhucS4uLmdJdDVkc3FZMjBVL2NrN0NFOXRKWVg=
- Add this to Vercel as
GITHUB_APP_PRIVATE_KEY_BASE64In your Vercel environment variables, add:GITHUB_APP_PRIVATE_KEY_BASE64=TUlJRW9nSUJBQUtDQVFFQXV2aFhucS4uLmdJdDVkc3FZMjBVL2NrN0NFOXRKWVg=
For local development and your GIthub App Webhook, you can use a tool like ngrok to expose your local server to the internet or deploy to Vercel:
ngrok http 3000