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

@ -23,3 +23,14 @@ export function buildMessage(
timestamp: partial.timestamp ?? new Date().toISOString(),
};
}
/**
* Base URL of the forge repo (e.g. `https://github.com/owner/repo` or a Gitea
* instance URL). Derived from `repository.html_url` in the payload so it works
* for any provider; falls back to github.com for legacy payloads.
*/
export function repoBaseUrl(payload: Record<string, unknown>, repo?: string): string | undefined {
const html = (payload.repository as { html_url?: string } | undefined)?.html_url;
if (html) return html;
return repo ? `https://github.com/${repo}` : undefined;
}