Files
claude-code-action/src/prepare/types.ts
km-anthropic b1033b2ba1 refactor: implement discriminated unions for GitHub contexts
Split ParsedGitHubContext into entity-specific and automation contexts:
- ParsedGitHubContext: For entity events (issues/PRs) with required entityNumber and isPR
- AutomationContext: For workflow_dispatch/schedule events without entity fields
- GitHubContext: Union type for all contexts

This eliminates ~20 null checks throughout the codebase and provides better type safety.
Entity-specific code paths are now guaranteed to have the required fields.

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-29 13:09:01 -07:00

21 lines
449 B
TypeScript

import type { GitHubContext } from "../github/context";
import type { Octokits } from "../github/api/client";
import type { Mode } from "../modes/types";
export type PrepareResult = {
commentId?: number;
branchInfo: {
baseBranch: string;
claudeBranch?: string;
currentBranch: string;
};
mcpConfig: string;
};
export type PrepareOptions = {
context: GitHubContext;
octokit: Octokits;
mode: Mode;
githubToken: string;
};