External system fires a workflow
repository_dispatch lets external systems trigger a workflow via POST to GitHub's API. The payload is arbitrary JSON, available in github.event.client_payload.
Common uses:
- Cross-repo orchestration — repo A finishes a build, fires dispatch in repo B which deploys it.
- External CI integration — Jenkins finishes a stage, dispatches to GitHub for the deploy.
- Manual triggers from outside GitHub — a Slack slash command, an internal admin tool, a webhook.
The POST
POST /repos/{owner}/{repo}/dispatches
Authorization: Bearer <PAT or App token with contents:write>
Body: {
"event_type": "deploy-prod",
"client_payload": { "version": "v1.4.2", "reason": "hotfix" }
}The workflow listens with on: repository_dispatch: types: [deploy-prod].
Trade-off vs workflow_dispatch
workflow_dispatch— manual UI / gh CLI, typed inputs, requires browser/PAT.repository_dispatch— programmatic, free-form JSON, suited for machine-to-machine.