Interview Prep/GitHub Actions/Expressions, Outputs, Matrix & Conditions

`Unrecognized named-value: 'secrets'. Located at position 1 within expression: secrets.NPM_TOKEN != ''`

IntermediateTroubleshootingExpressions, Outputs, Matrix & Conditions
Answer

Likely causes → Secrets referenced directly in an if: condition.

Diagnose → Find the if with secrets..

Fix →

env:
  HAS_TOKEN: ${{ secrets.NPM_TOKEN != '' }}
steps:
  - if: env.HAS_TOKEN == 'true'
    run: npm publish

Prevent → actionlint flags this.

All GitHub Actions questions Roadmap: GitHub Actions

More on Expressions, Outputs, Matrix & Conditions