A small Discord bot that receives GitHub webhooks and forwards events into configured channels.
Features
- Slash commands to set a feed channel (commits, PRs, issues, actions, etc.) and a release channel (releases + prereleases)
- Verifies GitHub webhook signatures
- Simple JSON storage for server configuration (single-server-focused)
Setup
-
Copy
.env.exampleto.envand fill values:DISCORD_TOKEN- your bot tokenCLIENT_ID- the Application ID of your botGUILD_ID- (recommended) the guild ID to register guild-only commandsGITHUB_WEBHOOK_SECRET- secret used when creating GitHub webhookPORT- port for webhook server (default 3000)
-
Install dependencies:
npm install
-
Run the bot:
npm run dev
-
Expose your dev server with a public URL (e.g., using ngrok) and add a webhook on the GitHub repository settings:
- Payload URL:
https://<your-host>/github-webhook - Content type:
application/json - Secret: same value as
GITHUB_WEBHOOK_SECRET - Select events: "Let me select individual events" and choose: Pushes, Pull requests, Issues, Workflow runs, Releases (only releases will go to the release channel)
- Payload URL:
-
Use slash commands in your server:
/set-feed-channel channel:#channel— sets the channel for commits, PRs, issues, actions/set-release-channel channel:#channel— sets the channel for release notifications/show-github-channels— display current configuration
Notes
- The bot sends release events only to the release channel and all other events to the feed channel.
- This is intentionally simple and focused for single-server use. Improve storage or multi-server behavior as needed.
Security
- Make sure to set
GITHUB_WEBHOOK_SECRETand use it in GitHub webhook settings.
License: MIT