| 1 | import type { Json } from "./runner.js"; |
| 2 | /** Events flowing through the `events` queue. Payload shapes follow GitHub webhooks where practical. */ |
| 3 | export type DiffineryEvent = |
| 4 | | { type: "push"; repoId: string; owner: string; repo: string; ref: string; before: string; after: string; actor: Actor; forced: boolean; created: boolean; deleted: boolean; at: string } |
| 5 | | { type: "pull_request"; action: "opened" | "synchronize" | "closed" | "reopened" | "edited" | "merged" | "enqueued" | "dequeued" | "assigned" | "review_requested" | "ready_for_review" | "converted_to_draft" | "auto_merge_enabled" | "auto_merge_disabled"; repoId: string; owner: string; repo: string; number: number; headRef: string; headSha: string; baseRef: string; actor: Actor; at: string; /** Logins newly assigned (assigned). */ assignees?: string[]; /** Logins newly asked to review (review_requested). */ reviewers?: string[] } |
| 6 | | { type: "issues"; action: "opened" | "closed" | "reopened" | "edited" | "assigned"; repoId: string; owner: string; repo: string; number: number; actor: Actor; at: string; /** Logins newly assigned (assigned). */ assignees?: string[] } |
| 7 | | { type: "issue_comment"; action: "created"; repoId: string; owner: string; repo: string; number: number; commentId: string; actor: Actor; at: string } |
| 8 | | { type: "pull_request_review"; action: "submitted"; repoId: string; owner: string; repo: string; number: number; state: string; actor: Actor; at: string } |
| 9 | | { type: "workflow_run"; action: "requested" | "completed"; repoId: string; owner: string; repo: string; runId: string; conclusion?: string; actor: Actor; at: string } |
| 10 | | { type: "workflow_dispatch"; repoId: string; owner: string; repo: string; ref: string; workflow: string; inputs: Record<string, Json>; actor: Actor; at: string } |
| 11 | /** GitHub-shaped events whose webhook payload is built where they happen (`payload` is merged into the body). */ |
| 12 | | { type: "release" | "status" | "deployment" | "deployment_status" | "deployment_review" | "repository_dispatch"; action?: string; repoId: string; owner: string; repo: string; payload: Record<string, Json>; actor: Actor; at: string } |
| 13 | | { type: "audit"; action: string; actor: Actor; target?: string; detail?: Record<string, Json>; at: string }; |
| 14 | |
| 15 | export interface Actor { |
| 16 | id: string; |
| 17 | login: string; |
| 18 | kind: "user" | "agent" | "system"; |
| 19 | /** For agents: the human or team that owns the agent. */ |
| 20 | onBehalfOf?: string; |
| 21 | } |