> For the complete documentation index, see [llms.txt](https://help.genesis.autify.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.genesis.autify.com/workflow/github-webhook-trigger-context.md).

# GitHub webhook trigger context

When a workflow is automatically triggered by a GitHub Webhook, metadata from the triggering GitHub event is automatically generated as context. This article describes the context fields passed for each event.

## How context works

When a workflow is triggered by a GitHub Webhook, the system extracts metadata from the event payload and structures it as **trigger context**. This context is automatically appended to the system prompt of AI Agent Blocks in the workflow, so the AI can reference the trigger metadata without any explicit configuration.

## Fields common to all events

These fields are always passed for every GitHub Webhook event.

| Field        | Description                                        | Example                           |
| ------------ | -------------------------------------------------- | --------------------------------- |
| `event`      | The type of event that triggered the workflow      | `push`, `pull_request`, `release` |
| `repository` | The full name of the repository                    | `owner/repo-name`                 |
| `branch`     | The base branch name                               | `main`, `release/v2`              |
| `sender`     | The login name of the user who triggered the event | `username`                        |

{% hint style="info" %}
All field values are passed as strings. Numeric values (such as PR numbers) are also passed as strings.
{% endhint %}

## Event-specific fields

### Push

Additional fields passed when code is pushed to a branch.

| Field           | Description                                | Example                                       |
| --------------- | ------------------------------------------ | --------------------------------------------- |
| `commitSha`     | The SHA of the HEAD commit                 | `abc123def456...`                             |
| `commitMessage` | The message of the HEAD commit             | `Fix: update login process`                   |
| `commitUrl`     | The URL of the HEAD commit                 | `https://github.com/owner/repo/commit/abc123` |
| `commitCount`   | The number of commits included in the push | `3`                                           |

### Pull request

Additional fields passed when a pull request is opened, updated, or closed.

| Field        | Description                    | Example                                 |
| ------------ | ------------------------------ | --------------------------------------- |
| `action`     | The action performed on the PR | `opened`, `closed`, `synchronize`       |
| `prNumber`   | The PR number                  | `42`                                    |
| `prTitle`    | The title of the PR            | `Feature: new dashboard`                |
| `prUrl`      | The URL of the PR              | `https://github.com/owner/repo/pull/42` |
| `headBranch` | The source branch of the PR    | `feature/new-dashboard`                 |
| `baseBranch` | The target branch of the PR    | `main`                                  |
| `headSha`    | The HEAD commit SHA of the PR  | `def456abc123...`                       |
| `merged`     | Whether the PR has been merged | `true`, `false`                         |

### Release

Additional fields passed when a new release is published.

| Field         | Description                          | Example                                             |
| ------------- | ------------------------------------ | --------------------------------------------------- |
| `action`      | The action performed on the release  | `published`, `created`, `edited`                    |
| `tagName`     | The tag name of the release          | `v1.2.3`                                            |
| `releaseName` | The name of the release              | `Version 1.2.3`                                     |
| `releaseUrl`  | The URL of the release               | `https://github.com/owner/repo/releases/tag/v1.2.3` |
| `prerelease`  | Whether the release is a pre-release | `true`, `false`                                     |

## How to reference context

Trigger context is automatically appended to the system prompt of AI Agent Blocks in the following format.

```
## Trigger Context
This workflow was automatically triggered. Here is the trigger metadata:
- **type**: github
- **event**: push
- **repository**: owner/repo-name
- **branch**: main
- **sender**: username
- **commitSha**: abc123def456...
- **commitMessage**: Fix: update login process
- **commitUrl**: https://github.com/owner/repo/commit/abc123
- **commitCount**: 1
```

By simply writing "Summarize the commit message" in the AI Agent Block prompt, the AI can automatically reference the commit information from the context.

## Related pages

* [Run a workflow](/workflow/workflow-execution.md)
* [GitHub integration](/resources-context/github-integration.md)
