Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/types/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ export interface GitHubLabelEvent {
name: string;
};
issue: {
id: bigint;
id: number;
number: number;
state: "open" | "closed";
labels: Array<{
name: string;
}>;
};
repository: {
id: bigint;
id: number;
name: string;
full_name: string;
owner: {
Expand All @@ -28,7 +28,7 @@ export interface GitHubLabelEvent {

// GitHub webhook payload interfaces
export interface GitHubAccount {
id: bigint;
id: number;
login: string;
type: string;
}
Expand All @@ -46,12 +46,12 @@ export interface GitHubInstallation {
}

export interface GitHubWebhookRepository {
id: bigint;
id: number;
name: string;
full_name: string;
owner?: GitHubAccount; // Optional for installation webhooks
owner?: GitHubAccount;
private: boolean;
html_url?: string; // Optional for installation webhooks
html_url?: string;
Comment on lines +52 to +54

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

These comments explaining why owner and html_url are optional were helpful. They clarified that these fields can be missing in installation-related webhooks. Restoring them would improve the maintainability and readability of this interface.

Suggested change
owner?: GitHubAccount;
private: boolean;
html_url?: string; // Optional for installation webhooks
html_url?: string;
owner?: GitHubAccount; // Optional for installation webhooks
private: boolean;
html_url?: string; // Optional for installation webhooks

description?: string;
}

Expand Down
8 changes: 4 additions & 4 deletions src/types/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const GitHubLabelEventSchema = z.object({
name: z.string(),
}),
issue: z.object({
id: z.bigint(),
id: z.number(),
number: z.number(),
state: z.enum(["open", "closed"]),
labels: z.array(
Expand All @@ -17,7 +17,7 @@ export const GitHubLabelEventSchema = z.object({
),
}),
repository: z.object({
id: z.bigint(),
id: z.number(),
name: z.string(),
full_name: z.string(),
owner: z.object({
Expand All @@ -34,14 +34,14 @@ export const GitHubWebhookEventSchema = z.object({
action: z.string(),
issue: z
.object({
id: z.bigint(),
id: z.number(),
number: z.number(),
state: z.string(),
labels: z.array(z.object({ name: z.string() })).optional(),
})
.optional(),
repository: z.object({
id: z.bigint(),
id: z.number(),
name: z.string(),
full_name: z.string(),
owner: z.object({
Expand Down
Loading