repository_dispatch

This page was generated based on Github’s Documentation. See our welcome page for context and details.

Github Event repository_dispatch #

Github Action Trigger #

source

Webhook event payloadActivity typesGITHUB_SHAGITHUB_REF
repository_dispatchCustomLast commit on default branchDefault 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 #

source

Activities: sample.collected

Common Fields #

These fields are common to every event types available with this trigger.
fieldtyperequireddescription
github.event.actionsample.collectedrequired
github.event.branchstringrequired
github.event.client_payloadobject or nullrequired
github.event.enterpriseobjectoptional

An enterprise on GitHub. Webhook payloads contain the enterprise property when the webhook is configured on an enterprise account or an organization that’s part of an enterprise account. For more information, see “About enterprise accounts."

github.event.installationobjectrequired

The GitHub App installation. Webhook payloads contain the installation property when the event is configured for and sent to a GitHub App. For more information, see “Using webhooks with GitHub Apps."

github.event.organizationobjectoptional

A GitHub organization. Webhook payloads contain the organization property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization.

github.event.repositoryobjectrequired

The repository on GitHub where the event occurred. Webhook payloads contain the repository property when the event occurs from activity in a repository.

github.event.senderobjectrequired

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.

fieldtyperequireddescription