fix: normalize Forgejo 'label_updated' to 'labeled' in context

Forgejo sends eventAction 'label_updated' instead of 'labeled' for
issue label events. Add FORGEJO_EVENT_ACTION_MAP in context.ts to
normalize at parse time (same pattern as event name normalization),
so all downstream code (trigger.ts, create-prompt) works unchanged.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Vlad MocanuandClaude Opus 4.6 committed 2026-02-26 10:25:58 +02:00
1 parent fa0070ddcc
commit baa007a3ec
2 files changed
+15 -7

No files matched your search

+14 -1
View File
@@ -68,10 +68,23 @@ const FORGEJO_EVENT_NAME_MAP: Record<string, string> = {
pull_request_comment: "pull_request_review_comment",
};
/**
* Forgejo uses different action names for some webhook event actions.
* Normalize to GitHub-canonical names so all downstream code works unchanged.
*/
const FORGEJO_EVENT_ACTION_MAP: Record<string, string> = {
label_updated: "labeled",
};
function normalizeEventName(eventName: string): string {
return FORGEJO_EVENT_NAME_MAP[eventName] ?? eventName;
}
function normalizeEventAction(action: string | undefined): string | undefined {
if (!action) return action;
return FORGEJO_EVENT_ACTION_MAP[action] ?? action;
}
const AUTOMATION_EVENT_NAMES = [
"workflow_dispatch",
"repository_dispatch",
@@ -149,7 +162,7 @@ export function parseGitHubContext(): GitHubContext {
const commonFields = {
runId: process.env.GITHUB_RUN_ID!,
eventAction: context.payload.action,
eventAction: normalizeEventAction(context.payload.action),
repository: {
owner: context.repo.owner,
repo: context.repo.repo,