A lightweight GitHub -> Discord notification pipeline for
repository activity.
cd-notify-discord provides a simple, configurable way to send GitHub
repository activity to a Discord channel using a webhook.
It is designed to be:
- configuration-driven
- free from third-party dependencies
- simple to use
Events are configured using Repository or Organization variables
that are defined under Secrets and variables section in Settings.
A required Discord webhook is also set as a repository secret.
See the quick setup guide to be up and running in a few minutes.
The following GitHub activities are currently supported. More may be added later by request.
- Push (commits)
- Create (branch / tag)
- Release (publish)
- Star (created/deleted)
Each event is enabled and configured via a named variable as defined below.
{variable name}={allowed values}
Triggered on repository pushes and configurable by branch:
CD_NOTIFY_DISCORD_PUSH_BRANCHES=main,develop,staging
Only pushes to the specified branches will generate notifications.
Triggered whenever a branch or tag is created.
CD_NOTIFY_DISCORD_CREATE=branch,tag
Supported values:
branchtag
Triggered on release activity. Currently only supports published
releases.
CD_NOTIFY_DISCORD_RELEASE=published
Triggered when a repository is starred.
CD_NOTIFY_DISCORD_STAR=enabled
Supported values:
enabled
Configuration is driven entirely through GitHub repository settings and
requires a Discord Webhook to establish communication with Discord from GitHub
and Repository variables to determine which activities trigger notifications.
Note the variables could be set at the Organization level if desired.
-
Webhooks are created in Discord: Right-click your channel -> Edit Channel -> Integrations -> Webhooks -> New Webhook`
-
View the created webook and click on the
Copy Webhook URLbutton to copy it to the clipboard (and it is recommended to explicitly name the webhook while you are there so you will know later what exactly it is being used for.)
https://discord.com/api/webhooks/23322424/aaabbbcccdddeeefffggg
- Location:
Repository -> Settings -> Secrets and variables -> Actions -> Secrets -> New repository secret
Name=CD_NOTIFY_DISCORD_WEBHOOK_URLSecret=https://discord.com/api/webhooks/23322424/aaabbbcccdddeeefffggg
The secret you enter in the configuration settings is the value copied from Discord when you created the webhook and it should be kept secret. (Anyone with this webhook could post activity on your Discord channel.)
Location:
Repository -> Settings -> Secrets and variables -> Actions -> Variables
Examples:
CD_NOTIFY_DISCORD_PUSH_BRANCHES=main
CD_NOTIFY_DISCORD_CREATE=branch,tag
CD_NOTIFY_DISCORD_RELEASE=published
CD_NOTIFY_DISCORD_STAR=enabled
- Missing or empty variables -> feature is disabled
- Values are comma-separated
- Values are case-insensitive
- Whitespace is ignored
- Unknown values are ignored
name: Notify Discord of GitHub Activity (`cd-notify-discord` from Continous-Delphi)
on:
push:
create:
release:
types: [published]
watch:
jobs:
notify:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Send Discord notification
shell: pwsh
env:
CD_NOTIFY_DISCORD_WEBHOOK_URL: ${{ secrets.CD_NOTIFY_DISCORD_WEBHOOK_URL }}
CD_NOTIFY_DISCORD_PUSH_BRANCHES: ${{ vars.CD_NOTIFY_DISCORD_PUSH_BRANCHES }}
CD_NOTIFY_DISCORD_CREATE: ${{ vars.CD_NOTIFY_DISCORD_CREATE }}
CD_NOTIFY_DISCORD_RELEASE: ${{ vars.CD_NOTIFY_DISCORD_RELEASE }}
CD_NOTIFY_DISCORD_STAR: ${{ vars.CD_NOTIFY_DISCORD_STAR }}
GITHUB_EVENT_NAME: ${{ github.event_name }}
GITHUB_EVENT_PATH: ${{ github.event_path }}
run: |
./tools/cd-notify-discord.ps1This tool is part of the Continuous-Delphi ecosystem, focused on strengthening Delphi's continued success

