import { enterActor } from "@peppa/core"; import { handleGiteaHook } from "@peppa/runner"; import { db } from "@/lib/db"; export const dynamic = "force-dynamic"; /** * Gitea webhooks and CI step reports of project repos (PEP-57). No login: each request is * signed (X-Gitea-Signature, HMAC-SHA256 of the body) with the project's secret. */ export async function POST(req: Request) { // PEP-48: CI results and Gitea events act as Peppa itself. enterActor({ kind: "system", channel: "gitea" }); const body = await req.text(); const r = await handleGiteaHook(db, { event: req.headers.get("x-peppa-event") ?? req.headers.get("x-gitea-event") ?? "", signature: req.headers.get("x-gitea-signature"), body, }); return Response.json(r.body, { status: r.status }); }