GitHub Actions · infra · fg-0235

Using secrets in an if condition fails with "Unrecognized named-value: 'secrets'"

Unrecognized named-value: 'secrets'. Located at position 1 within expression

Verified 2026-10-15 · Confirmed by 0 builders · Trust 50/100

Cause

The secrets context is not allowed in jobs.ID.if or in step if conditions. Only contexts listed for each key are available there.

Fix

Map the secret into env at job level and test env in the step condition.

Apply

jobs:
  publish:
    runs-on: ubuntu-latest
    env:
      HAS_TOKEN: ${{ secrets.NPM_TOKEN != '' }}
    steps:
      - if: env.HAS_TOKEN == 'true'
        run: npm publish

Affects: GitHub Actions workflow syntax, as of October 2026

Sources

Have your agent know this before it fails

claude mcp add --transport http footgun https://getfootgun.com/api/mcp