Skip to content

Conditionally run a step only if a secret is defined? #25735

Answered by weide-zhou
simonw asked this question in Actions
Discussion options

You must be logged in to vote

Hi @simonw,

Please use below format instead. secrets.* is not recognized in if expression. You can set it as env and read via env.*.

      - name: check
        if: contains(env.TESTKEY1, 'value1')         # use env value instead.
        run: |
          echo test
        env:
            TESTKEY1: ${{secrets.TESTKEY1}}         

Thanks

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants