# GitHub Fork Event

> GitHub fork webhook payload with forkee repository details.

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

## Install

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

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

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

## Types

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

export interface GitHubForkEvent {
  forkee: GitHubRepository;
  repository: GitHubRepository;
  sender: GitHubUser;
  organization?: GitHubOrganization;
}
```

## Zod validator

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

export const githubForkEventSchema = z.object({
  forkee: githubRepositorySchema,
  repository: githubRepositorySchema,
  sender: githubUserSchema,
  organization: githubOrganizationSchema.optional(),
}) satisfies z.ZodType<GitHubForkEvent>;

export type { GitHubForkEvent } from "../types/github-fork-event";
```

## Examples

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

const forkeeRepository = {
  id: 186853002,
  node_id: "MDEwOlJlcG9zaXRvcnkxODY4NTMwMDI=",
  name: "Hello-World",
  full_name: "new-owner/Hello-World",
  private: false,
  owner: {
    login: "new-owner",
    id: 21031067,
    node_id: "MDQ6VXNlcjIxMDMxMDY3",
    avatar_url: "https://avatars.githubusercontent.com/u/21031067?v=4",
    url: "https://api.github.com/users/new-owner",
    html_url: "https://github.com/new-owner",
    type: "User",
    site_admin: false,
  },
  html_url: "https://github.com/new-owner/Hello-World",
  description: "Forked for experiments",
  fork: true,
  url: "https://api.github.com/repos/new-owner/Hello-World",
  default_branch: "main",
} as const satisfies GitHubRepository;

const minimal = {
  forkee: forkeeRepository,
  repository: githubRepositoryHelloWorld,
  sender: githubUserOctocat,
} as const satisfies GitHubForkEvent;

export const githubForkEventExamples = {
  minimal,
  full: { ...minimal, organization: githubOrganizationGitHub } satisfies GitHubForkEvent,
  intoPrivate: {
    ...minimal,
    forkee: { ...forkeeRepository, private: true } satisfies GitHubRepository,
  } satisfies GitHubForkEvent,
} as const;
```
