# GitHub Issue Comment Event

> GitHub issue_comment webhook payload with comment body, author association, and edit tracking.

- Name: `github-issue-comment-event`
- Categories: github
- Depends on: `@open-types/github-shared`, `@open-types/github-issues-event`
- Detail page: https://open-types.dev/types/github-issue-comment-event

## Install

```bash
# Types only
npx shadcn add @open-types/github-issue-comment-event

# Types + Zod v4 validators
npx shadcn add @open-types/github-issue-comment-event-zod

# Types + real-world examples
npx shadcn add @open-types/github-issue-comment-event-examples
```

## Types

```typescript
import type {
  GitHubUser,
  GitHubRepository,
  GitHubOrganization,
  GitHubAuthorAssociation,
} from "./github-shared";
import type { GitHubIssue } from "./github-issues-event";

export type GitHubIssueCommentAction = "created" | "deleted" | "edited";

export interface GitHubIssueComment {
  id: number;
  node_id: string;
  user: GitHubUser;
  created_at: string;
  updated_at: string;
  body: string | null;
  html_url: string;
  url: string;
  author_association: GitHubAuthorAssociation;
}

export interface GitHubIssueCommentChanges {
  body?: { from: string };
}

export interface GitHubIssueCommentEvent {
  action: GitHubIssueCommentAction;
  issue: GitHubIssue;
  comment: GitHubIssueComment;
  repository: GitHubRepository;
  sender: GitHubUser;
  organization?: GitHubOrganization;
  changes?: GitHubIssueCommentChanges;
}
```

## Zod validator

```typescript
import * as z from "zod";
import type {
  GitHubIssueCommentAction,
  GitHubIssueComment,
  GitHubIssueCommentChanges,
  GitHubIssueCommentEvent,
} from "../types/github-issue-comment-event";
import {
  githubUserSchema,
  githubRepositorySchema,
  githubOrganizationSchema,
  githubAuthorAssociationSchema,
} from "./github-shared";
import { githubIssueSchema } from "./github-issues-event";

export const githubIssueCommentActionSchema = z.enum([
  "created",
  "deleted",
  "edited",
]);

export const githubIssueCommentSchema = z.object({
  id: z.number().int(),
  node_id: z.string(),
  user: githubUserSchema,
  created_at: z.string(),
  updated_at: z.string(),
  body: z.string().nullable(),
  html_url: z.string(),
  url: z.string(),
  author_association: githubAuthorAssociationSchema,
}) satisfies z.ZodType<GitHubIssueComment>;

export const githubIssueCommentChangesSchema = z.object({
  body: z.object({ from: z.string() }).optional(),
}) satisfies z.ZodType<GitHubIssueCommentChanges>;

export const githubIssueCommentEventSchema = z.object({
  action: githubIssueCommentActionSchema,
  issue: githubIssueSchema,
  comment: githubIssueCommentSchema,
  repository: githubRepositorySchema,
  sender: githubUserSchema,
  organization: githubOrganizationSchema.optional(),
  changes: githubIssueCommentChangesSchema.optional(),
}) satisfies z.ZodType<GitHubIssueCommentEvent>;

export type {
  GitHubIssueCommentAction,
  GitHubIssueComment,
  GitHubIssueCommentChanges,
  GitHubIssueCommentEvent,
} from "../types/github-issue-comment-event";
```

## Examples

```typescript
// Source: https://docs.github.com/en/webhooks/webhook-events-and-payloads#issue_comment
// Captured: 2026-05
import type {
  GitHubIssueComment,
  GitHubIssueCommentChanges,
  GitHubIssueCommentEvent,
} from "../types/github-issue-comment-event";
import {
  githubUserOctocat,
  githubUserBot,
  githubRepositoryHelloWorld,
  githubOrganizationGitHub,
} from "./shared/github.examples";
import { githubIssueExamples } from "./github-issues-event.examples";

const comment = {
  id: 1,
  node_id: "MDEyOklzc3VlQ29tbWVudDE=",
  user: githubUserOctocat,
  created_at: "2024-09-12T10:30:00Z",
  updated_at: "2024-09-12T10:30:00Z",
  body: "Me too",
  html_url: "https://github.com/octocat/Hello-World/issues/1347#issuecomment-1",
  url: "https://api.github.com/repos/octocat/Hello-World/issues/comments/1",
  author_association: "COLLABORATOR",
} as const satisfies GitHubIssueComment;

export const githubIssueCommentExamples = {
  minimal: comment,
  fromOwner: { ...comment, author_association: "OWNER" } satisfies GitHubIssueComment,
  fromContributor: {
    ...comment,
    author_association: "CONTRIBUTOR",
  } satisfies GitHubIssueComment,
  deletedBody: { ...comment, body: null } satisfies GitHubIssueComment,
  byBot: { ...comment, user: githubUserBot, author_association: "NONE" } satisfies GitHubIssueComment,
} as const;

export const githubIssueCommentChangesExamples = {
  body: { body: { from: "Original comment" } } satisfies GitHubIssueCommentChanges,
  empty: {} satisfies GitHubIssueCommentChanges,
} as const;

const created = {
  action: "created",
  issue: githubIssueExamples.minimal,
  comment,
  repository: githubRepositoryHelloWorld,
  sender: githubUserOctocat,
} as const satisfies GitHubIssueCommentEvent;

export const githubIssueCommentEventExamples = {
  created,
  edited: {
    ...created,
    action: "edited",
    changes: { body: { from: "Original comment" } },
  } satisfies GitHubIssueCommentEvent,
  deleted: {
    ...created,
    action: "deleted",
    comment: { ...comment, body: null },
  } satisfies GitHubIssueCommentEvent,
  onClosedIssue: {
    ...created,
    issue: githubIssueExamples.closed,
  } satisfies GitHubIssueCommentEvent,
  inOrg: {
    ...created,
    organization: githubOrganizationGitHub,
  } satisfies GitHubIssueCommentEvent,
} as const;
```
