# GitHub Ping Event

> GitHub ping webhook payload with zen message and hook configuration.

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

## Install

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

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

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

## Types

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

export interface GitHubHookConfig {
  content_type?: string;
  insecure_ssl?: string;
  url?: string;
}

export interface GitHubHook {
  type: string;
  id: number;
  name: string;
  active: boolean;
  events: string[];
  config: GitHubHookConfig;
  created_at: string;
  updated_at: string;
}

export interface GitHubPingEvent {
  zen: string;
  hook_id: number;
  hook: GitHubHook;
  repository?: GitHubRepository;
  sender: GitHubUser;
  organization?: GitHubOrganization;
}
```

## Zod validator

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

export const githubHookConfigSchema = z.object({
  content_type: z.string().optional(),
  insecure_ssl: z.string().optional(),
  url: z.string().optional(),
}) satisfies z.ZodType<GitHubHookConfig>;

export const githubHookSchema = z.object({
  type: z.string(),
  id: z.number().int(),
  name: z.string(),
  active: z.boolean(),
  events: z.array(z.string()),
  config: githubHookConfigSchema,
  created_at: z.string(),
  updated_at: z.string(),
}) satisfies z.ZodType<GitHubHook>;

export const githubPingEventSchema = z.object({
  zen: z.string(),
  hook_id: z.number().int(),
  hook: githubHookSchema,
  repository: githubRepositorySchema.optional(),
  sender: githubUserSchema,
  organization: githubOrganizationSchema.optional(),
}) satisfies z.ZodType<GitHubPingEvent>;

export type {
  GitHubHookConfig,
  GitHubHook,
  GitHubPingEvent,
} from "../types/github-ping-event";
```

## Examples

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

const hookConfig = {
  content_type: "json",
  insecure_ssl: "0",
  url: "https://example.com/webhook",
} as const satisfies GitHubHookConfig;

export const githubHookConfigExamples = {
  full: hookConfig,
  contentTypeOnly: { content_type: "json" } satisfies GitHubHookConfig,
  empty: {} satisfies GitHubHookConfig,
} as const;

const hook = {
  type: "Repository",
  id: 12345678,
  name: "web",
  active: true,
  events: ["push", "pull_request"],
  config: hookConfig,
  created_at: "2024-09-12T10:15:30Z",
  updated_at: "2024-09-12T10:15:30Z",
} as const satisfies GitHubHook;

export const githubHookExamples = {
  minimal: hook,
  allEvents: {
    ...hook,
    events: ["*"],
  } satisfies GitHubHook,
} as const;

const minimal = {
  zen: "Non-blocking is better than blocking.",
  hook_id: 12345678,
  hook,
  repository: githubRepositoryHelloWorld,
  sender: githubUserOctocat,
} as const satisfies GitHubPingEvent;

export const githubPingEventExamples = {
  minimal,
  full: {
    ...minimal,
    organization: githubOrganizationGitHub,
  } satisfies GitHubPingEvent,
  orgHook: (() => {
    const { repository, ...rest } = minimal;
    return { ...rest, organization: githubOrganizationGitHub } satisfies GitHubPingEvent;
  })(),
} as const;
```
