An external provisioning service must trigger a GitHub Actions workflow over the REST API after it finishes setting up infrastructure, passing a custom JSON payload that the run can read. Which event should the workflow listen for?
on:
<trigger>:
types: [infra-ready]- Aworkflow_dispatch, because an external system posts the custom event to the API and the run reads the data through the github.event.client_payload context.
- Bpush, because an external system can post a commit to the API and the run reads the supplied data through the github.event.client_payload context.
- Cschedule, because an external system registers a cron entry through the API and the run reads the supplied data through the github.event.client_payload context.
- Drepository_dispatch, because an external system posts a custom event type to the API and the run reads the data through the github.event.client_payload context. Correct
Why A is wrong: Tempting because both events are manually initiated, but workflow_dispatch is meant for a person using the UI or CLI and exposes named inputs, not a free-form client_payload from an external service.
Why B is wrong: Tempting because pushing through the API does start runs, but push carries commit and ref data only, has no custom event_type, and never populates a client_payload field.
Why C is wrong: Tempting because both are non-interactive, but schedule fires on an internal cron timer with no external payload, so there is no client_payload for the run to read.
Why D is correct: The repository_dispatch event is designed for outside systems to start a workflow through the REST API with a chosen event_type and a client_payload that the run reads via github.event.client_payload.