Skip to content
Latchkey

How to Inspect the Event Payload in GitHub Actions

The github.event context is the full webhook payload; dumping it shows exactly which fields exist for the event that triggered the run.

Print ${{ toJSON(github.event) }}, or cat the file at $GITHUB_EVENT_PATH. Both show the raw payload so you can confirm a field like github.event.pull_request.merged is actually present.

Steps

  • Add a step that dumps the event payload.
  • Find the field path you need (it differs per event type).
  • Use jq on $GITHUB_EVENT_PATH to extract a single value.

Workflow

.github/workflows/ci.yml
steps:
  - name: Dump the event payload
    env:
      EVENT: ${{ toJSON(github.event) }}
    run: echo "$EVENT"
  - name: Pull one field out with jq
    run: |
      jq '.action, .pull_request.number' "$GITHUB_EVENT_PATH"

Gotchas

  • Payload shape depends on the event; a push payload has no pull_request object.
  • github.event.head_commit is null for many events, which breaks naive [skip ci] checks.
  • The file at $GITHUB_EVENT_PATH is the same data the context exposes.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →