Skip to content

Variables and expressions ​

Encyclopedia home · Search machine-readable catalog

The broken snippets are deliberate negative examples. Use only in an isolated fixture repository or lab.

F039 ​

Misspelled expression context

Symptom. Unrecognized named-value.

Root cause. Expression contexts have fixed names.

Broken example

yaml
env: {BRANCH: "${{ gitub.ref_name }}"}

Corrected example

yaml
env: {BRANCH: "${{ github.ref_name }}"}

Verification. Confirm branch string explicitly in a non-secret fixture.

Correction validation syntax-validated.

F040 ​

Output read before producer ID exists

Symptom. downstream version is empty.

Root cause. Name and ID are different. The producer ID is build.

Broken example

yaml
env: {VERSION: "${{ steps.package.outputs.version }}"}

Corrected example

yaml
env: {VERSION: "${{ steps.build.outputs.version }}"}

Verification. Print a benign release version into output and test nonempty.

Correction validation syntax-validated.

F041 ​

Environment output written with no newline

Symptom. a contains a merged record, b is absent.

Root cause. File protocol requires one assignment per line.

Broken example

bash
printf 'a=1' >> "$GITHUB_OUTPUT"
printf 'b=2' >> "$GITHUB_OUTPUT"

Corrected example

bash
printf 'a=1\nb=2\n' >> "$GITHUB_OUTPUT"

Verification. Verify steps.ID.outputs.a and .b independently.

Correction validation syntax-validated.

F042 ​

Job if tries to read matrix before expansion

Symptom. unrecognized named-value matrix.

Root cause. Job-level if is evaluated before matrix expansion.

Broken example

yaml
if: matrix.python == '3.12'

Corrected example

yaml
strategy:
  matrix:
    python: ["3.12"]

Verification. Filter the matrix or use a step-level if.

Correction validation syntax-validated.

F043 ​

String value used as boolean

Symptom. deploy runs while flag prints false.

Root cause. The string false is nonempty and truthy.

Broken example

yaml
if: env.DEPLOY

Corrected example

yaml
if: env.DEPLOY == 'true'

Verification. Test both literal values on a dry-run job.

Correction validation syntax-validated.

F044 ​

Secret checked directly in step condition

Symptom. unrecognized named-value secrets.

Root cause. secrets is not available directly in if.

Broken example

yaml
if: secrets.DEPLOY_TOKEN != ''

Corrected example

yaml
env:
  DEPLOY_TOKEN: ${{ secrets.DEPLOY_TOKEN }}
if: env.DEPLOY_TOKEN != ''

Verification. Make the step safe when it gets no secret.

Correction validation syntax-validated.

F045 ​

Invalid dynamic matrix JSON

Symptom. error parsing fromJSON input.

Root cause. rows contains a plain string, matrix_json contains a validated object.

Broken example

yaml
matrix: ${{ fromJSON(needs.plan.outputs.rows) }}

Corrected example

yaml
matrix: ${{ fromJSON(needs.plan.outputs.matrix_json) }}

Verification. Validate producer output with jq and ensure nonempty dimensions.

Correction validation syntax-validated.

F046 ​

Plain shell variable lost between steps

Symptom. the next step reads an empty variable.

Root cause. Every step gets a separate process.

Broken example

bash
export IMAGE_TAG=lab

Corrected example

bash
printf 'IMAGE_TAG=lab\n' >> "$GITHUB_ENV"

Verification. Check the tag in a later step.

Correction validation syntax-validated.