Skip to Content
flowpact

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: ''`).

CodeNameCategoryDefault severityReported by
FP107optional-forwarded-to-requiredInputs🟡 warninglint, 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:18

Why 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 required

Accept 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):

.github/workflows/pipeline.yml
# flowpact: ignore[FP107] why it is acceptable here
notes: ${{ inputs.release-notes }}

In the config, with an override, which can expire:

.github/flowpact/flowpact.config.yml
overrides:
  - rule: FP107
    target: ".github/workflows/build.yml#inputs.notes"
    reason: Why it is acceptable here, at least 10 characters.
    expires: YYYY-MM-DD   # optional

target 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:

.github/flowpact/flowpact.config.yml
rules:
  FP107: off
  # or: optional-forwarded-to-required: error

Explain it in the terminal:

flowpact explain FP107
  • FP105 optional-input-no-default-in-condition: An optional input that is '' when omitted (no default, or default: '') decides an if: by its truthiness.
  • FP101 missing-required-input: A reusable workflow or local action is called without one of its required inputs.

On this page