Proxy and filter gitea embeds to discord
Go to file
disqualifier 3470b794d7 init: gitea-discord-proxy to proc whs
Signed-off-by: disqualifier <dev@disqualifier.me>
2026-06-22 19:46:01 -04:00
.gitignore init: gitea-discord-proxy to proc whs 2026-06-22 19:46:01 -04:00
README.md init: gitea-discord-proxy to proc whs 2026-06-22 19:46:01 -04:00

gitea-discord-proxy

A tiny passthrough that makes Gitea's Discord webhook notifications render like GitHub's. Gitea sends a native Discord embed; this proxy rewrites only the embed description into GitHub style (backticked commit hash, message collapsed to its first line, author kept) and forwards the otherwise-untouched payload to the real Discord webhook.

How it works

It mirrors Discord's webhook path, so you point a Gitea webhook at this proxy by swapping the hostname:

https://discord.com/api/webhooks/<id>/<token>
        ->
http://127.0.0.1:8000/api/webhooks/<id>/<token>

The real Discord webhook id/token live in the path, so one proxy serves every repo — no per-repo config. Gitea and the proxy run on the same host, so traffic stays on localhost; nothing is exposed publicly.

Run

pip install -r requirements.txt
uvicorn app:app --host 127.0.0.1 --port 8000

Health check at GET /healthz.

Gitea webhook setup

Per repo (or as a default/system webhook):

  • Type: Discord
  • Target URL: http://127.0.0.1:8000/api/webhooks/<id>/<token> (the real webhook's id/token, host swapped to the proxy)
  • Content type: application/json
  • Trigger: Push Events (or whatever you want)

Notes

  • The reformat regex is matched to Gitea's current Discord embed description format ([hash](url) message - author, commits joined by newlines). If a future Gitea version changes that layout, the regex in app.py needs a small tweak. This is the tradeoff for reformatting Gitea's pre-built embed rather than parsing raw push payloads.
  • Title, branches, multiple commits, tags, and colors pass through as Gitea produced them.