feat: add gitea/forgejo support

This commit is contained in:
RhenCloud 2026-08-11 22:01:04 +08:00
parent ace036c209
commit aec0d1a257
43 changed files with 683 additions and 130 deletions

View file

@ -0,0 +1,20 @@
import type { Env, WebhookEvent } from "../../types";
import type { Provider } from "../types";
import { verifyGiteaSignature } from "./verify";
import { parseGiteaEvent } from "./parse";
export const giteaProvider: Provider = {
id: "gitea",
matches(headers) {
return headers["x-gitea-event"] !== undefined;
},
async verify(body, headers, env: Env) {
return verifyGiteaSignature(body, headers["x-gitea-signature"], env.GITEA_WEBHOOK_SECRET);
},
parse(body, headers): WebhookEvent | null {
return parseGiteaEvent(headers, body);
},
};