FP105 · optional-input-no-default-in-condition
An optional input without a default decides an `if:` condition by its truthiness.
| Code | Name | Category | Default severity |
|---|---|---|---|
FP105 | optional-input-no-default-in-condition | Inputs | 🟡 warning |
Why it matters
When a caller omits an optional input that has no default, GitHub substitutes an empty string. A condition such as if: inputs.x then takes the "false" branch silently, so jobs or steps are skipped and the run is still green.
How to fix
Give the input an explicit default, make it required: true, or compare explicitly (inputs.x != '', inputs.x == 'yes'). Not reported: comparisons with a constant, contains()-style tests, fallbacks (inputs.x || 'default'), and inputs every local caller passes — unless the workflow can be dispatched or the unit is published (by default the root action.yml and reusable workflows whose file name does not start with _; see impact.publish), since callers in other repositories can still omit them.
Scope
Not reported in generated files, which are not edited by hand.
Example
inputs:
variant: { type: string, required: false }
...
if: inputs.variantConfigure
Change the severity (or turn the rule off) in .github/flowpact/flowpact.config.yml, by code or by name:
rules:
FP105: off
# or: optional-input-no-default-in-condition: errorExplain it in the terminal:
flowpact explain FP105