mirror of
https://github.com/anthropics/claude-code-action.git
synced 2026-01-22 22:44:13 +08:00
Major features: - Mode auto-detection based on GitHub event type - Unified prompt field replacing override_prompt and direct_prompt - Slash command system with pre-built commands - Full backward compatibility with v0.x Key changes: - Add mode detector for automatic mode selection - Implement slash command loader with YAML frontmatter support - Update action.yml with new prompt input - Create pre-built slash commands for common tasks - Update all tests for v1.0 compatibility Breaking changes (with compatibility): - Mode input now optional (auto-detected) - override_prompt deprecated (use prompt) - direct_prompt deprecated (use prompt)
107 lines
2.3 KiB
TypeScript
107 lines
2.3 KiB
TypeScript
export type CommonFields = {
|
|
repository: string;
|
|
claudeCommentId: string;
|
|
triggerPhrase: string;
|
|
triggerUsername?: string;
|
|
customInstructions?: string;
|
|
allowedTools?: string;
|
|
disallowedTools?: string;
|
|
prompt?: string; // v1.0: Unified prompt field
|
|
directPrompt?: string; // Deprecated
|
|
overridePrompt?: string; // Deprecated
|
|
};
|
|
|
|
type PullRequestReviewCommentEvent = {
|
|
eventName: "pull_request_review_comment";
|
|
isPR: true;
|
|
prNumber: string;
|
|
commentId?: string; // May be present for review comments
|
|
commentBody: string;
|
|
claudeBranch?: string;
|
|
baseBranch?: string;
|
|
};
|
|
|
|
type PullRequestReviewEvent = {
|
|
eventName: "pull_request_review";
|
|
isPR: true;
|
|
prNumber: string;
|
|
commentBody: string;
|
|
claudeBranch?: string;
|
|
baseBranch?: string;
|
|
};
|
|
|
|
type IssueCommentEvent = {
|
|
eventName: "issue_comment";
|
|
commentId: string;
|
|
issueNumber: string;
|
|
isPR: false;
|
|
baseBranch: string;
|
|
claudeBranch: string;
|
|
commentBody: string;
|
|
};
|
|
|
|
// Not actually a real github event, since issue comments and PR coments are both sent as issue_comment
|
|
type PullRequestCommentEvent = {
|
|
eventName: "issue_comment";
|
|
commentId: string;
|
|
prNumber: string;
|
|
isPR: true;
|
|
commentBody: string;
|
|
claudeBranch?: string;
|
|
baseBranch?: string;
|
|
};
|
|
|
|
type IssueOpenedEvent = {
|
|
eventName: "issues";
|
|
eventAction: "opened";
|
|
isPR: false;
|
|
issueNumber: string;
|
|
baseBranch: string;
|
|
claudeBranch: string;
|
|
};
|
|
|
|
type IssueAssignedEvent = {
|
|
eventName: "issues";
|
|
eventAction: "assigned";
|
|
isPR: false;
|
|
issueNumber: string;
|
|
baseBranch: string;
|
|
claudeBranch: string;
|
|
assigneeTrigger?: string;
|
|
};
|
|
|
|
type IssueLabeledEvent = {
|
|
eventName: "issues";
|
|
eventAction: "labeled";
|
|
isPR: false;
|
|
issueNumber: string;
|
|
baseBranch: string;
|
|
claudeBranch: string;
|
|
labelTrigger: string;
|
|
};
|
|
|
|
type PullRequestEvent = {
|
|
eventName: "pull_request";
|
|
eventAction?: string; // opened, synchronize, etc.
|
|
isPR: true;
|
|
prNumber: string;
|
|
claudeBranch?: string;
|
|
baseBranch?: string;
|
|
};
|
|
|
|
// Union type for all possible event types
|
|
export type EventData =
|
|
| PullRequestReviewCommentEvent
|
|
| PullRequestReviewEvent
|
|
| PullRequestCommentEvent
|
|
| IssueCommentEvent
|
|
| IssueOpenedEvent
|
|
| IssueAssignedEvent
|
|
| IssueLabeledEvent
|
|
| PullRequestEvent;
|
|
|
|
// Combined type with separate eventData field
|
|
export type PreparedContext = CommonFields & {
|
|
eventData: EventData;
|
|
};
|