Skip to content

repository-dispatch-event

The repository-dispatch event is a mechanism within GitHub Actions that allows workflows to be triggered programmatically by external tools or other workflows within the same repository.^[400-devops__04-CI-CD-Pipelines__devops-ci__github-action__README.md]

This functionality enables the implementation of [[event-driven architecture]] patterns by allowing one workflow to initiate another. For example, a "Ping" workflow can be configured to listen for a specific event type, which upon execution, triggers a corresponding "Pong" workflow.^[400-devops__04-CI-CD-Pipelines__devops-ci__github-action__README.md]

Event Configuration

To use this event, workflows must define a specific event_type that they listen for. The source provided demonstrates distinct event types such as run-ping, run-pong, and run-done to route execution to the correct workflows^[400-devops__04-CI-CD-Pipelines__devops-ci__github-action__README.md].

Triggering Strategies

There are two primary architectural strategies for implementing these dispatch events:

  • Multiple Workflows: Each workflow handles a specific stage of a process and triggers the next workflow in the sequence.^[400-devops__04-CI-CD-Pipelines__devops-ci__github-action__README.md]
  • Single Workflow (Modes): A single "all-in-one" workflow handles multiple scenarios. In this pattern, the workflow listens to an array of event types, but the specific behavior or "running mode" is determined by a command passed in the payload body of the dispatch event^[400-devops__04-CI-CD-Pipelines__devops-ci__github-action__README.md].

Sources

^[400-devops__04-CI-CD-Pipelines__devops-ci__github-action__README.md]