Add Gitea-to-Claude-Code-Routines webhook proxy

Express service that authenticates Gitea deliveries, verifies the HMAC
signature, builds a readable text summary for push/pull_request events,
and forwards it to the Anthropic routines API with the headers Gitea
can't set itself. Includes in-memory delivery dedup, structured logging,
.env.example, and a Dockerfile for deployment behind nginx.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-23 20:57:22 +02:00
parent 1bf6caf90e
commit 6decb31448
5 changed files with 1106 additions and 0 deletions

19
.env.example Normal file
View File

@@ -0,0 +1,19 @@
# Puerto en el que escucha el proxy (nginx hará proxy_pass hacia aquí)
PORT=3000
# Valor exacto que Gitea debe enviar en el header "Authorization".
# Configúralo igual en Gitea (Settings -> Webhooks -> Authorization header).
GITEA_AUTH_HEADER=changeme-secreto-A
# Secret configurado en el webhook de Gitea, usado para verificar la firma
# HMAC-SHA256 del header "X-Gitea-Signature".
GITEA_WEBHOOK_SECRET=changeme-secreto-gitea
# ID de la rutina de Claude Code (parte de la URL /routines/{ROUTINE_ID}/fire)
ROUTINE_ID=trig_xxxxxxxxxxxxxxxxxxxxxxxx
# Token de la rutina (sk-ant-oat01-...), se envía como "Authorization: Bearer <token>"
ROUTINE_TOKEN=sk-ant-oat01-changeme
# TTL en milisegundos para el dedup en memoria de entregas de Gitea (X-Gitea-Delivery)
DEDUP_TTL_MS=300000