Using exit code of previous step

So I know you can use output of steps by referring to steps.\<step id\>.outputs.\<output name\>.

Is it also possible to use exit code of previous step?

Pseudo code:

steps:
      - id: example
        uses: repo/some-external-action@master
      - if: steps.example.exitcode > 0
        run: echo "Something went wrong"
- if: failure()
- if: success()

This is the only solution to know if Action step completed successfully or not that I know.

5 Likes

Perfect hint, thank you! Works in my situation.

More info: https://help.github.com/en/actions/automating-your-workflow-with-github-actions/contexts-and-expression-syntax-for-github-actions#job-status-check-functions

2 Likes