This page was generated based on Github’s Documentation. See our welcome page for context and details.
Github Event repository_dispatch
#
Github Action Trigger #
Webhook event payload | Activity types | GITHUB_SHA | GITHUB_REF |
---|---|---|---|
repository_dispatch | Custom | Last commit on default branch | Default branch |
Note: This event will only trigger a workflow run if the workflow file is on the default branch.
You can use the GitHub API to trigger a webhook event called repository_dispatch
when you want to trigger a workflow for activity that happens outside of GitHub. For more information, see “REST API endpoints for repositories.”
When you make a request to create a repository_dispatch
event, you must specify an event_type
to describe the activity type. By default, all repository_dispatch
activity types trigger a workflow to run. You can use the types
keyword to limit your workflow to run when a specific event_type
value is sent in the repository_dispatch
webhook payload.
on:
repository_dispatch:
types: [test_result]
Note: The event_type
value is limited to 100 characters.
Any data that you send through the client_payload
parameter will be available in the github.event
context in your workflow. For example, if you send this request body when you create a repository dispatch event:
{
"event_type": "test_result",
"client_payload": {
"passed": false,
"message": "Error: timeout"
}
}
then you can access the payload in a workflow like this:
on:
repository_dispatch:
types: [test_result]
jobs:
run_if_failure:
if: ${{ !github.event.client_payload.passed }}
runs-on: ubuntu-latest
steps:
- env:
MESSAGE: ${{ github.event.client_payload.message }}
run: echo $MESSAGE
Notes:
- The maximum number of top-level properties in
client_payload
is 10. - The payload can contain a maximum of 65,535 characters.
Event Payload #
Activities: sample.collected
Common Fields #
These fields are common to every event types available with this trigger.
field | type | required | description |
---|---|---|---|
github.event.action | sample.collected | required | |
github.event.branch | string | required | |
github.event.client_payload | object or null | required | |
github.event.enterprise | object | optional | An enterprise on GitHub. Webhook payloads contain the |
github.event.installation | object | required | The GitHub App installation. Webhook payloads contain the |
github.event.organization | object | optional | A GitHub organization. Webhook payloads contain the |
github.event.repository | object | required | The repository on GitHub where the event occurred. Webhook payloads contain the |
github.event.sender | object | required | The GitHub user that triggered the event. This property is included in every webhook payload. |
sample.collected
#
This event occurs when a GitHub App sends a POST
request to /repos/{owner}/{repo}/dispatches
. For more information, see the REST API documentation for creating a repository dispatch event.
To subscribe to this event, a GitHub App must have at least read-level access for the "Contents" repository permission.
field | type | required | description |
---|