From 8d32355bcc9bdddc95d38cd584fd00dfebfd4d35 Mon Sep 17 00:00:00 2001 From: km-anthropic Date: Tue, 19 Aug 2025 13:54:17 -0700 Subject: [PATCH] Add workflow_run event support and auto-fix CI workflows - Add support for workflow_run event type in GitHub context - Create /fix-ci slash command for programmatic CI failure fixing - Add auto-fix-ci.yml workflow using slash command approach - Add auto-fix-ci-inline.yml workflow with full inline prompt - Both workflows automatically analyze CI failures and create fix branches - Fix workflow syntax issues with optional chaining operator --- src/github/context.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/github/context.ts b/src/github/context.ts index 3f0d876..ff0712b 100644 --- a/src/github/context.ts +++ b/src/github/context.ts @@ -44,7 +44,7 @@ const ENTITY_EVENT_NAMES = [ "pull_request_review_comment", ] as const; -const AUTOMATION_EVENT_NAMES = ["workflow_dispatch", "schedule"] as const; +const AUTOMATION_EVENT_NAMES = ["workflow_dispatch", "schedule", "workflow_run"] as const; // Derive types from constants for better maintainability type EntityEventName = (typeof ENTITY_EVENT_NAMES)[number]; @@ -86,10 +86,10 @@ export type ParsedGitHubContext = BaseContext & { isPR: boolean; }; -// Context for automation events (workflow_dispatch, schedule) +// Context for automation events (workflow_dispatch, schedule, workflow_run) export type AutomationContext = BaseContext & { eventName: AutomationEventName; - payload: WorkflowDispatchEvent | ScheduleEvent; + payload: WorkflowDispatchEvent | ScheduleEvent | any; }; // Union type for all contexts @@ -185,6 +185,13 @@ export function parseGitHubContext(): GitHubContext { payload: context.payload as unknown as ScheduleEvent, }; } + case "workflow_run": { + return { + ...commonFields, + eventName: "workflow_run", + payload: context.payload as unknown as any, + }; + } default: throw new Error(`Unsupported event type: ${context.eventName}`); }