This service forwards GitHub webhook events to Slack channels.
- Go to your GitHub repository and click on Settings.
- Select Webhooks from the left sidebar.
- Click the Add webhook button.
- In the Payload URL field, enter:
https://your-deployment-url/webhook/your-slack-channel- Replace
your-deployment-urlwith the base URL where this service is deployed (for EnTur, this isgithub-slack-bridge.dev.entur.org). - Replace
your-slack-channelwith the name of the Slack channel you want to send notifications to.
- Replace
- Set the Content type to
application/json. - In the Secret field, enter your webhook secret. This field is mandatory and must match the
GITHUB_WEBHOOK_SECRETenvironment variable set in the service (for EnTur, this is available in 1Password). - Under Which events would you like to trigger this webhook?:
- Select Let me select individual events.
- Check the following events:
Push,Pull requests, andWorkflow runs.
- Make sure Active is checked.
- Click Add webhook to save your configuration.
After setting up the webhook, GitHub will send a ping event to verify the connection. You should see this event in your service logs.
If you want to add the webhook to multiple repositories, you can use the gh_webook_tool.sh script to automate the process.
For EnTur, the secret is available in 1Password. By default it does not make any changes. Add --no-dry-run to actually make changes:
./batch_add_webhook.sh --secret 'webhook secret' --channel 'your-slack-channel' topic some-topic # For RoR we use 'ror'
./batch_add_webhook.sh --secret 'webhook secret' --channel 'your-slack-channel' team some-team # For RoR we use 'team-ruter-reiseplanlegger'POST /webhook/{channel}
Configure your GitHub repository webhooks to send events to this endpoint. The {channel} parameter in the URL specifies which Slack channel should receive the notifications.
This service requires the following environment variables (for EnTur, these are available in 1Password):
SLACK_WEBHOOK_URL- Required. The Slack incoming webhook URL that messages will be sent to.- Example:
https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXX
- Example:
GITHUB_WEBHOOK_SECRET- Required. The secret used to validate GitHub webhook payloads.
- Push events (to main/master/prod branches)
- Pull request events (opened, closed, reopened)
- Workflow run events (failed builds and fixed builds)
- Java 21 or higher
- Kotlin 2.2.0
./gradlew rundocker build -t github-slack-bridge .
docker run -p 8080:8080 \
-e SLACK_WEBHOOK_URL=your_slack_webhook_url \
-e GITHUB_WEBHOOK_SECRET=your_github_secret \
github-slack-bridge./gradlew shadowJar
java -jar build/libs/github-slack-bridge-all.jar./gradlew test./gradlew buildThis project is maintained by EnTur, using European Union Public License 1.2