19 lines
631 B
TypeScript
19 lines
631 B
TypeScript
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) {
|
|
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 });
|
|
}
|