How to check status of previous step? #26060
-
Hello, Please note, in my build.sh script, i already set The following workflow doesn’t work for some reason, I think i am unable to read
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
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:
There are two problems here:
For the comment steps, note that the documentation on Job status check functions says this:
For the “Create comment if build is ok” step that’s probably fine, but for the “Create comment if build fails” I assume you want a condition like this:
|
Beta Was this translation helpful? Give feedback.
-
Hi @martyrs, Glad to see you in Github Community Forum! You can get the step status via step context, check the In the latter step, check with if expression Thanks |
Beta Was this translation helpful? Give feedback.
-
Thank you all.
|
Beta Was this translation helpful? Give feedback.
-
Hi @martyrs, Just one comment, Thanks |
Beta Was this translation helpful? Give feedback.
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:
There are two problems here:
If the
build.sh
script fails, the step will exit there, so theset-output
will never be issued. See Exit codes and error action preference for details and the recommended workaround.The second echo will always write “Exited with 0”, because in Bash
$?
is always the exit status of the previous command. For the secondecho
that’s the firstecho
, and I don’t se…