Skip to content

Secrets cannot be used to condition job runs #520

@mzabaluev

Description

@mzabaluev

Describe the bug
The secrets context is apparently not available to if conditional expressions on jobs.

To Reproduce
Create and trigger a workflow with jobs conditioned on the value of a secret:

jobs:
  build_bulky_stuff:
    if: ${{ secrets.BUILD_BULKY_STUFF == 'true' }}
    # ...

Here's a real world example.

Expected behavior
The condition is successfully evaluated and if the secret value is set to 'true', the job is run.

Runner Version and Platform

Version of your runner? No idea, GitHub hosted.

OS of the machine running the runner? Linux

What's not working?

The workflow fails with:

The workflow is not valid. .github/workflows/release.yml (Line: 11, Col: 9): Unrecognized named-value: 'secrets'. Located at position 1 within expression: secrets.BUILD_RELEASES == 'true',.github/workflows/release.yml (Line: 35, Col: 9): Unrecognized named-value: 'secrets'. Located at position 1 within expression: secrets.BUILD_RELEASES == 'true'

Job Log Output

See this workflow run

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions