> 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)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://help.genesis.autify.com/workflow/github-webhook-trigger-context.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
