FP501 · undefined-env-ref
`${{ env.NAME }}` reads a variable that is not defined at workflow, job or step level, nor written to `$GITHUB_ENV` earlier.
| Code | Name | Category | Default severity | Reported by |
|---|---|---|---|---|
FP501 | undefined-env-ref | Env & expressions | 🟡 warning | lint, check, the action, the editor |
What you see
In the deep-nesting fixture:
▲ WARN FP501 undefined-env-ref
env.TARGET_URL is not defined in this scope
▶ .github/workflows/publish.yml:34:36Why it matters
The env context only contains variables set by the workflow itself — not runner defaults like GITHUB_SHA. Reads of anything else evaluate to an empty string.
How to fix
Define the variable under env:, write it to $GITHUB_ENV in an earlier step, or use the matching context (e.g. github.sha).
Example
run: echo ${{ env.GITHUB_SHA }}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[FP501] why):
# flowpact: ignore[FP501] why it is acceptable here
- run: echo "uploaded to ${{ env.TARGET_URL }}"In the config, with an override, which can expire:
overrides:
- rule: FP501
target: ".github/workflows/publish.yml#jobs.upload.env.TARGET_URL"
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 == "FP501") | .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:
FP501: off
# or: undefined-env-ref: errorExplain it in the terminal:
flowpact explain FP501