Skip to content

How to check status of previous step? #26060

Answered by airtower-luna
martyrs asked this question in Actions
Discussion options

You must be logged in to vote

It’s hard to say exactly what is causing your problem without a detailed description of the problem (and ideally a link to a workflow run), but I already see a few problems:

martyrs:
        run: |
          ./build.sh
          echo ::set-output name=exit_code::$?
          echo "Exited with $?"

There are two problems here:

  1. If the build.sh script fails, the step will exit there, so the set-output will never be issued. See Exit codes and error action preference for details and the recommended workaround.

  2. The second echo will always write “Exited with 0”, because in Bash $? is always the exit status of the previous command. For the second echo that’s the first echo, and I don’t se…

Replies: 4 comments 1 reply

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants