DevOps

GitHub Webhook (Push Event) JSON Example

A real-world JSON example of a GitHub webhook push event payload — ref, commits, pusher, and repository info. Copy-ready for building CI triggers, deploy bots, and GitHub App integrations.

{
  "ref": "refs/heads/main",
  "before": "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0",
  "after": "b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1",
  "repository": {
    "id": 892345671,
    "name": "jsonkit",
    "full_name": "jsonkit-dev/jsonkit",
    "private": false,
    "default_branch": "main"
  },
  "pusher": {
    "name": "jsonkit-dev",
    "email": "jsonkit.in@gmail.com"
  },
  "commits": [
    {
      "id": "b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1",
      "message": "Add JSON Patch generator tool",
      "timestamp": "2026-07-10T09:12:00+05:30",
      "author": {
        "name": "JSONKit",
        "email": "jsonkit.in@gmail.com"
      },
      "added": [
        "src/app/json-patch-generator/page.tsx"
      ],
      "modified": [
        "src/lib/tools.ts"
      ],
      "removed": []
    }
  ],
  "head_commit": {
    "id": "b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1",
    "message": "Add JSON Patch generator tool",
    "timestamp": "2026-07-10T09:12:00+05:30"
  }
}

Field Reference

refrequiredstringThe full git ref that was pushed, e.g. refs/heads/main — check this to filter for a specific branch
before / afterrequiredstringThe commit SHAs before and after the push — 'before' is all zeros for a new branch's first push
commitsrequiredarrayEvery commit included in the push, oldest first — can be empty for a force-push that removes commits
pusherrequiredobjectThe GitHub user who performed the push — not necessarily the commit author
repository.default_branchrequiredstringUseful for detecting whether this push was to the repo's default branch, since ref alone doesn't tell you that

Variants

New Branch (First Push)before is all zeros, signaling this ref did not exist before this push.
New Branch (First Push)
{
  "ref": "refs/heads/feature/excel-converter",
  "before": "0000000000000000000000000000000000000000",
  "after": "c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2",
  "created": true,
  "commits": [
    {
      "id": "c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2",
      "message": "Initial Excel converter scaffold",
      "timestamp": "2026-07-08T14:20:00+05:30"
    }
  ]
}

Common Use Cases

  • Triggering a CI/CD pipeline or deploy bot in response to pushes to a specific branch
  • Building a custom Slack/Discord notification bot for team commit activity
  • Auditing which files changed in a push without cloning the repository
githubwebhookpush eventci/cdgit

Validate or format this JSON

One click loads this exact example into the tool — no copy-paste needed. Format it, validate it, explore the tree, or generate TypeScript types instantly.

Frequently Asked Questions

GitHub signs every webhook payload with an HMAC-SHA256 signature in the X-Hub-Signature-256 header, computed using your webhook's configured secret. Recompute it server-side and compare before trusting the payload.

A force-push that moves the branch backward, or a push that only moves a tag, can report zero new commits even though ref/before/after all changed — always check commits.length before assuming there's new work to process.

pusher is whoever ran git push (has GitHub push access), while each commit's author is whoever wrote that specific commit — they're often the same person but differ when someone pushes a rebased or cherry-picked commit authored by a teammate.

Related JSON Examples