diff --git a/src/github/context.ts b/src/github/context.ts index 92f272cb1..4001fda5c 100644 --- a/src/github/context.ts +++ b/src/github/context.ts @@ -7,6 +7,7 @@ import type { PullRequestReviewEvent, PullRequestReviewCommentEvent, WorkflowRunEvent, + PushEvent, } from "@octokit/webhooks-types"; import { CLAUDE_APP_BOT_ID, CLAUDE_BOT_LOGIN } from "./constants"; // Custom types for GitHub Actions events that aren't webhooks @@ -65,6 +66,7 @@ const AUTOMATION_EVENT_NAMES = [ "repository_dispatch", "schedule", "workflow_run", + "push", ] as const; // Derive types from constants for better maintainability @@ -111,14 +113,15 @@ export type ParsedGitHubContext = BaseContext & { isPR: boolean; }; -// Context for automation events (workflow_dispatch, repository_dispatch, schedule, workflow_run) +// Context for automation events (workflow_dispatch, repository_dispatch, schedule, workflow_run, push) export type AutomationContext = BaseContext & { eventName: AutomationEventName; payload: | WorkflowDispatchEvent | RepositoryDispatchEvent | ScheduleEvent - | WorkflowRunEvent; + | WorkflowRunEvent + | PushEvent; }; // Union type for all contexts @@ -233,6 +236,13 @@ export function parseGitHubContext(): GitHubContext { payload: context.payload as unknown as WorkflowRunEvent, }; } + case "push": { + return { + ...commonFields, + eventName: "push", + payload: context.payload as unknown as PushEvent, + }; + } default: throw new Error(`Unsupported event type: ${context.eventName}`); }