Skip to content

What is usage difference between: job.status == 'success' and if :success() ? #25173

Discussion options

You must be logged in to vote

job.status is a context of the current job. Possible values are success, failure, or cancelled. job.status could be used not only in if conditional but also in other places, such as using it as an input variable value of an action.  

- name: Dump job context
        env:
          JOB_STATUS: ${{ job.status }}
        run: echo "$JOB_STATUS"

success() is a check function which could be used as an expression in if conditionals.

When they are used in jobs.<job_id>.steps.if  conditional, there is no difference between them. You could choose any one you like.  

success() could be used in jobs.<job_id>.if , but job.status  could not.

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
2 participants