1. A team wants to trigger a workflow in Repository B from an external system (e.g., a deployment pipeline outside GitHub) using an HTTP POST request, passing a custom payload with a `service` field. Which event and configuration should they use in Repository B's workflow?
- A. Use `workflow_dispatch` and call the GitHub API's workflow dispatch endpoint with the payload as `inputs`
- B. Use `repository_dispatch` with a `types` filter and send a POST to the repository's dispatches endpoint with an `event_type` and `client_payload`✓ Correct
- C. Use `push` with a path filter so the external system can push a file to trigger the workflow
- D. Use `schedule` with a very short cron interval so the workflow polls frequently and reads the payload from a repository variable
Explanation
`repository_dispatch` is the correct event for triggering a workflow from **external** systems via the GitHub REST API. The caller POSTs to `/repos/{owner}/{repo}/dispatches` with an `event_type` and optional `client_payload`, and the workflow filters on `types`. The custom `service` field would be in `client_payload` and accessible via `${{ github.event.client_payload.service }}`. **A** is wrong because `workflow_dispatch` requires a user or GitHub App to trigger it via the API or UI; it does not accept arbitrary `client_payload` — it only accepts predefined `inputs`. While it can be triggered via API, it lacks the `client_payload` flexibility needed. **C** is wrong because forcing a file push is a workaround, not a proper mechanism, and couples the external system to repository content. **D** is wrong because `schedule` cannot receive payloads at all; it only runs at fixed times.