Skip to content
Latchkey

How to Choose Between workflow_dispatch, repository_dispatch, and Webhooks

workflow_dispatch is for humans, repository_dispatch is for external systems POSTing the API, and native webhook events fire on repo activity.

Pick by who starts the run: a person (workflow_dispatch), an external system via the API (repository_dispatch), or repository activity such as a push or PR (native webhook events).

When to use each

TriggerStarted byTypical use
workflow_dispatchA person via UI or ghManual runs with inputs
repository_dispatchExternal system via REST POSTCross-repo or third-party triggers
push / pull_requestRepository activityNormal CI on commits and PRs

Combine dispatch triggers

.github/workflows/ci.yml
on:
  workflow_dispatch:
    inputs:
      ref: { type: string, default: main }
  repository_dispatch:
    types: [deploy-request]
jobs:
  run:
    runs-on: ubuntu-latest
    steps:
      - run: echo "ref ${{ inputs.ref || github.event.client_payload.ref }}"

Gotchas

  • Both dispatch triggers run only on the default branch.
  • Native events give richer context (github.event) than a dispatch payload you construct.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →