Workflow Dispatch Choice Input Validation
0 reputation · 25 Mar 2022, 07:59 UTC
Goal: Ensure that a workflow_dispatch trigger only accepts predefined values for a choice‑typed input, regardless of whether the workflow is started from the GitHub UI or the REST API.
Current behavior: GitHub validates that the input exists and matches the declared type (string) but does not verify that the supplied value is one of the enumerated options defined in the workflow YAML. This means an API caller can pass an arbitrary string, and the workflow will receive it unless the job adds explicit validation steps.
Uncertainty: Whether there is a built‑in mechanism to reject undefined choice values at trigger time, or if enforcement must be deferred to the workflow itself.
- Is there a way to configure the workflow_dispatch event to automatically reject inputs that are not listed in the choice options?
- If not, what is the recommended pattern for early validation of choice inputs without delaying job execution?
- Does the GitHub UI enforce the choice list while the API does not, and is this discrepancy documented?