This repository hosts the centralized logic for Discord notifications across our organization. Instead of configuring a bot for every single repository, we use a Reusable Workflow.
- Go to the templates/ folder in this repository.
- Copy the content of
discord-notify.yml. - In your project repository, create a file at:
.github/workflows/discord-notify.yml - Paste the content and save.
Ensure this central repository (github-webhook-bot) allows access to other repositories:
- Go to Settings -> Actions -> General.
- Scroll to Access.
- Ensure "Accessible from repositories in the 'YOUR_ORG_NAME' organization" is selected.
The bot relies on a single Organization Secret.
- Go to Organization Settings -> Secrets and variables -> Actions.
- Create a New organization secret:
- Name:
DISCORD_REPORTING_BOT_WEBHOOK - Value:
https://discord.com/api/webhooks/...(Your Discord Webhook URL) - Access: "All repositories".
- Name:
If you want to change the message format, colors, or logic, you only need to edit this repository.
src/index.js- Main Logic. All the JavaScript code that generates Discord embeds resides here..github/workflows/reusable-bot.yml- The Workflow. Defines the GitHub Action that other repos call.templates/- Boilerplate. Ready-to-use YAML files for other teams.
To edit the logic locally:
-
Install dependencies:
npm install
-
Lint/Check: The project uses
node-fetchand standard Node.js libraries. Ensure you do not commitnode_modules.
Just push to the main branch.
All repositories using the @main reference in their workflow will automatically start using the updated logic immediately.
node-fetch: For sending HTTP requests to Discord.dotenv: For local development variable management.