# GitHub Star Event

> GitHub star webhook payload with created/deleted action and timestamp.

- Name: `github-star-event`
- Categories: github
- Depends on: `@open-types/github-shared`
- Detail page: https://open-types.dev/types/github-star-event

## Install

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

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

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

## Types

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

export type GitHubStarEventAction = "created" | "deleted";

export interface GitHubStarEvent {
  action: GitHubStarEventAction;
  starred_at: string | null;
  repository: GitHubRepository;
  sender: GitHubUser;
  organization?: GitHubOrganization;
}
```

## Zod validator

```typescript
import * as z from "zod";
import type {
  GitHubStarEventAction,
  GitHubStarEvent,
} from "../types/github-star-event";
import {
  githubUserSchema,
  githubRepositorySchema,
  githubOrganizationSchema,
} from "./github-shared";

export const githubStarEventActionSchema = z.enum([
  "created",
  "deleted",
]) satisfies z.ZodType<GitHubStarEventAction>;

export const githubStarEventSchema = z.object({
  action: githubStarEventActionSchema,
  starred_at: z.string().nullable(),
  repository: githubRepositorySchema,
  sender: githubUserSchema,
  organization: githubOrganizationSchema.optional(),
}) satisfies z.ZodType<GitHubStarEvent>;

export type {
  GitHubStarEventAction,
  GitHubStarEvent,
} from "../types/github-star-event";
```

## Examples

```typescript
// Source: https://docs.github.com/en/webhooks/webhook-events-and-payloads#star
// Captured: 2026-05
import type { GitHubStarEvent } from "../types/github-star-event";
import {
  githubUserOctocat,
  githubRepositoryHelloWorld,
  githubOrganizationGitHub,
} from "./shared/github.examples";

const created = {
  action: "created",
  starred_at: "2024-09-12T14:23:09Z",
  repository: githubRepositoryHelloWorld,
  sender: githubUserOctocat,
} as const satisfies GitHubStarEvent;

export const githubStarEventExamples = {
  created,
  deleted: {
    ...created,
    action: "deleted",
    starred_at: null,
  } satisfies GitHubStarEvent,
  inOrg: { ...created, organization: githubOrganizationGitHub } satisfies GitHubStarEvent,
} as const;
```
