Skip to content
Latchkey

GitHub Actions workflow_dispatch Inputs Empty or Wrong Type

A manually dispatched workflow reads its inputs as empty or behaves oddly because they are referenced from the wrong context, a boolean input is actually a string, or the input was never declared.

What this error means

A workflow_dispatch run reads an input as an empty string, or a boolean input always evaluates truthy because it is compared as a string rather than a boolean.

.github/workflows/ci.yml
# boolean input compared as a string is always truthy
if: github.event.inputs.deploy == 'true'   # works
if: github.event.inputs.deploy             # 'false' string is still truthy

Common causes

Input not declared or wrong context

Inputs must be declared under on.workflow_dispatch.inputs. Reading an undeclared input, or using the wrong context, yields an empty value.

Boolean inputs are strings in some contexts

A workflow_dispatch boolean input is exposed as the string "true"/"false" via github.event.inputs, so a bare truthiness check on the string is always true.

How to fix it

Declare inputs and use the inputs context

Declare each input with a type, then read it via the inputs context, comparing booleans explicitly.

.github/workflows/ci.yml
on:
  workflow_dispatch:
    inputs:
      deploy:
        type: boolean
        default: false
jobs:
  go:
    if: ${{ inputs.deploy == true }}
    runs-on: ubuntu-latest
    steps: [{ run: ./deploy.sh }]

Compare string inputs against literals

  1. For github.event.inputs.<name>, compare against the string "true" rather than relying on truthiness.
  2. Prefer the typed inputs context (inputs.<name>) where available.
  3. Set default: values so optional inputs are never empty.

How to prevent it

  • Declare every workflow_dispatch input with a type and default.
  • Compare boolean inputs explicitly instead of bare truthiness.
  • Prefer the inputs context over github.event.inputs.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →