Cloudflare Worker which can be used as a middleware between Gitlab webhooks and Discord webhooks to send out custom discord messages when your projects pipeline failed.
- Create a new Discord webhook in the desired notification channel and save the webhook
url as a new secret named
DISCORD_WEBHOOK
- Choose a secret which will allow Gitlab to access to the worker and save it
as a new secret named
GITLAB_WEBHOOK_SECRET_TOKEN
- Create a new KV store and change the
wrangler.toml
accordingly. - Create new KV pairs to configure the notifications (see configuration)
- Create a new Gitlab webhook in the desired repository.
- URL: the deployment url of this worker
- Secret token: the chosen secret
- Trigger: disable all but
Pipeline events
- SSL verification: true
The configuration takes advantage of Cloudflare's key value store as each key in the configured kv store represents the notification configuration for one specific repository.
key: repository web url
value: {"branch_name": "notification text", ...}
for example:
key: https://gitlab.com/example-group/example-project
value: {"main": "<@&979396042485276733> Die Pipeline der Webseite für den main-Branch ist fehlgeschlagen!", ...}