FP107 · optional-forwarded-to-required
A required input of a callee is fed from an optional input that is '' when omitted (no default, or `default: ''`).
| Code | Name | Category | Default severity | Reported by |
|---|---|---|---|---|
FP107 | optional-forwarded-to-required | Inputs | 🟡 warning | lint, check, the action, the editor |
What you see
In the deep-nesting fixture:
▲ WARN FP107 optional-forwarded-to-required
Required input "notes" of .github/workflows/build.yml is empty when optional input "release-notes" is omitted
▶ .github/workflows/pipeline.yml:24:18Why it matters
The call looks complete, so GitHub never complains about the required input, but when the outer caller omits the optional value the callee receives an empty string. The "required" guarantee is lost one level up.
How to fix
Make the outer input required too, give it a non-empty default, or add a non-empty fallback: ${{ inputs.x || 'value' }}. If the callee handles an empty value, make its input required: false. If the call is pointless without the value, skip it with if: inputs.x != ''.
Example
# pipeline.yml
inputs:
config: { type: string, required: false }
jobs:
test:
uses: ./.github/workflows/test.yml
with:
config: ${{ inputs.config }} # test.yml: config is requiredAccept one finding
When a finding is intended, accept it with a reason rather than turning the rule off. It is listed apart from the other findings, and does not fail the build.
On its line, with an ignore comment alone on the line above it (the
editor's quick fix adds it there) or at the end of the line, after any other comment such as a version
(# v4.3.0 # flowpact: ignore[FP107] why):
# flowpact: ignore[FP107] why it is acceptable here
notes: ${{ inputs.release-notes }}In the config, with an override, which can expire:
overrides:
- rule: FP107
target: ".github/workflows/build.yml#inputs.notes"
reason: Why it is acceptable here, at least 10 characters.
expires: YYYY-MM-DD # optionaltarget is the symbol the finding is about; to list them:
flowpact lint --format json | jq -r '.findings[] | select(.code == "FP107") | .symbol'* matches within a path segment and ** across segments, so one entry accepts every finding whose symbol matches:
target: '**#inputs.app-id' is that input in every workflow and action.
Change the severity
Change the severity (or turn the rule off) in .github/flowpact/flowpact.config.yml, by code or by name:
rules:
FP107: off
# or: optional-forwarded-to-required: errorExplain it in the terminal:
flowpact explain FP107