# GitHub Release Event

> GitHub release webhook payload with assets, tag tracking, and draft/prerelease flags.

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

## Install

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

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

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

## Types

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

export interface GitHubReleaseAsset {
  url: string;
  browser_download_url: string;
  id: number;
  node_id: string;
  name: string;
  label: string | null;
  state: string;
  content_type: string;
  size: number;
  download_count: number;
  created_at: string;
  updated_at: string;
}

export interface GitHubRelease {
  url: string;
  html_url: string;
  id: number;
  node_id: string;
  tag_name: string;
  target_commitish: string;
  name: string | null;
  body: string | null;
  draft: boolean;
  prerelease: boolean;
  created_at: string;
  published_at: string | null;
  author: GitHubUser;
  assets: GitHubReleaseAsset[];
}

export type GitHubReleaseEventAction =
  | "published"
  | "unpublished"
  | "created"
  | "edited"
  | "deleted"
  | "prereleased"
  | "released";

export interface GitHubReleaseEvent {
  action: GitHubReleaseEventAction;
  release: GitHubRelease;
  repository: GitHubRepository;
  sender: GitHubUser;
  organization?: GitHubOrganization;
}
```

## Zod validator

```typescript
import * as z from "zod";
import type {
  GitHubReleaseAsset,
  GitHubRelease,
  GitHubReleaseEventAction,
  GitHubReleaseEvent,
} from "../types/github-release-event";
import {
  githubUserSchema,
  githubRepositorySchema,
  githubOrganizationSchema,
} from "./github-shared";

export const githubReleaseAssetSchema = z.object({
  url: z.string(),
  browser_download_url: z.string(),
  id: z.number().int(),
  node_id: z.string(),
  name: z.string(),
  label: z.string().nullable(),
  state: z.string(),
  content_type: z.string(),
  size: z.number().int(),
  download_count: z.number().int(),
  created_at: z.string(),
  updated_at: z.string(),
}) satisfies z.ZodType<GitHubReleaseAsset>;

export const githubReleaseSchema = z.object({
  url: z.string(),
  html_url: z.string(),
  id: z.number().int(),
  node_id: z.string(),
  tag_name: z.string(),
  target_commitish: z.string(),
  name: z.string().nullable(),
  body: z.string().nullable(),
  draft: z.boolean(),
  prerelease: z.boolean(),
  created_at: z.string(),
  published_at: z.string().nullable(),
  author: githubUserSchema,
  assets: z.array(githubReleaseAssetSchema),
}) satisfies z.ZodType<GitHubRelease>;

export const githubReleaseEventActionSchema = z.enum([
  "published",
  "unpublished",
  "created",
  "edited",
  "deleted",
  "prereleased",
  "released",
]) satisfies z.ZodType<GitHubReleaseEventAction>;

export const githubReleaseEventSchema = z.object({
  action: githubReleaseEventActionSchema,
  release: githubReleaseSchema,
  repository: githubRepositorySchema,
  sender: githubUserSchema,
  organization: githubOrganizationSchema.optional(),
}) satisfies z.ZodType<GitHubReleaseEvent>;

export type {
  GitHubReleaseAsset,
  GitHubRelease,
  GitHubReleaseEventAction,
  GitHubReleaseEvent,
} from "../types/github-release-event";
```

## Examples

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

const tarballAsset = {
  url: "https://api.github.com/repos/octocat/Hello-World/releases/assets/1",
  browser_download_url: "https://github.com/octocat/Hello-World/releases/download/v1.0.0/source.tar.gz",
  id: 1,
  node_id: "MDEyOlJlbGVhc2VBc3NldDE=",
  name: "source.tar.gz",
  label: null,
  state: "uploaded",
  content_type: "application/gzip",
  size: 1024,
  download_count: 0,
  created_at: "2024-09-12T10:15:30Z",
  updated_at: "2024-09-12T10:15:31Z",
} as const satisfies GitHubReleaseAsset;

const binaryAsset = {
  url: "https://api.github.com/repos/octocat/Hello-World/releases/assets/2",
  browser_download_url: "https://github.com/octocat/Hello-World/releases/download/v1.0.0/app-linux-x64",
  id: 2,
  node_id: "MDEyOlJlbGVhc2VBc3NldDI=",
  name: "app-linux-x64",
  label: "Linux x86_64 binary",
  state: "uploaded",
  content_type: "application/octet-stream",
  size: 8_421_376,
  download_count: 142,
  created_at: "2024-09-12T10:16:00Z",
  updated_at: "2024-09-12T10:16:05Z",
} as const satisfies GitHubReleaseAsset;

export const githubReleaseAssetExamples = {
  source: tarballAsset,
  labeled: binaryAsset,
} as const;

const release = {
  url: "https://api.github.com/repos/octocat/Hello-World/releases/1",
  html_url: "https://github.com/octocat/Hello-World/releases/tag/v1.0.0",
  id: 1,
  node_id: "MDc6UmVsZWFzZTE=",
  tag_name: "v1.0.0",
  target_commitish: "main",
  name: "v1.0.0",
  body: "Initial public release.",
  draft: false,
  prerelease: false,
  created_at: "2024-09-12T10:15:30Z",
  published_at: "2024-09-12T10:20:00Z",
  author: githubUserOctocat,
  assets: [tarballAsset],
} as const satisfies GitHubRelease;

export const githubReleaseExamples = {
  minimal: release,
  draft: {
    ...release,
    draft: true,
    published_at: null,
  } satisfies GitHubRelease,
  prerelease: {
    ...release,
    tag_name: "v1.0.0-rc.1",
    name: "v1.0.0 RC 1",
    prerelease: true,
  } satisfies GitHubRelease,
  multipleAssets: {
    ...release,
    assets: [tarballAsset, binaryAsset],
  } satisfies GitHubRelease,
  noName: { ...release, name: null, body: null } satisfies GitHubRelease,
} as const;

const minimal = {
  action: "published",
  release,
  repository: githubRepositoryHelloWorld,
  sender: githubUserOctocat,
} as const satisfies GitHubReleaseEvent;

export const githubReleaseEventExamples = {
  minimal,
  full: {
    ...minimal,
    organization: githubOrganizationGitHub,
  } satisfies GitHubReleaseEvent,
  edited: { ...minimal, action: "edited" } satisfies GitHubReleaseEvent,
  deleted: { ...minimal, action: "deleted" } satisfies GitHubReleaseEvent,
  prereleased: {
    ...minimal,
    action: "prereleased",
    release: {
      ...release,
      tag_name: "v1.0.0-beta.1",
      prerelease: true,
    },
  } satisfies GitHubReleaseEvent,
} as const;
```
