Skip to content

Count the total number of successful steps in a job using github actions #25362

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

You must be logged in to vote

Hi @uditgaurav,

uditgaurav:

Let us suppose I want to run step5 only if anyone of step4 or step3 ran successfully(or both doesn’t skip) how to build such logic around this?

Step status can be got from step context: ‘steps.step_id.outcome’ or ‘steps.step_id.conclusion’. Please check the official doc for more details.
You can use a combined expression for step5, code sample as below:

      - name: step3
        id: step3
        continue-on-error: true
        run: |
          exit 1
      - name: step4
        id: step4
        continue-on-error: true
        run: |
          exit 1
      - name: step5
        if: always()&&(steps.step3.outcome=='success' || steps.step4.outcome=='succes…

Replies: 6 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
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
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