Skip to content

A conditional step with a previous output and failure won't run #24941

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

You must be logged in to vote

Hi @utgwkk ,

The upload-artifact step is not executed due to previous step ‘do_test’ failed. You need to add failure() expression check as well. Code sample as below:

    steps:
          - id: do_test
            run: |
              echo hello > hello.txt
              false
          - id: foo
            run: |
              if [-e 'hello.txt']; then
                echo "::set-output name=exists::true"
              fi
            if: failure()
      - name: check steps.foo.outputs.exists
        run: echo ${{ steps.foo.outputs.exists }}
        if: always()

      - uses: actions/upload-artifact@v2
        with:
          name: hello
          path: hello.txt
        if: failure() &…

Replies: 1 comment

Comment options

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