Search code examples
github-actions

Is there a way to continue on error while still getting correct feedback?


I'm trying to find a way to achieve the following functionality: Whenever a step fails, it will show that it failed (will provide correct feedback) but will still continue to other steps.

At the moment, failure causes the step to stop:

Step's failure prevents next step from starting

I've seen the most popular suggestion is to use continue-on-error, but that seems to make the step's conclusion 'Success', and will not show it failed unless you go into the logs.

Failed step appears to be successful

In the screenshot above, the "Secrets" step failed, and yet it appears to be successful unless entering the logs.

When reading this thread, I came to suspect this feature might not exist yet in GH actions.

I've also tried using conditionals for each step, and/or for the job. For example, I've tried: if: ${{ success() }} || ${{ failure() }} - this simply did not provide the needed functionality, the step failed and the next step did not start.

if: succeeded() || failed() - took this syntax from the GitHub community thread above, but it generated a syntax error (which makes sense, since it isn't compatible with the syntax specified here).

To conclude, I'm looking for a way to make steps that fail indicate they failed, and still make the workflow continue to the next step.


Solution

  • To my surprise, and thanks to @smac89 for suggesting it - adding if: always() seems to do the trick. I'm still wondering why if: ${{ success() }} || ${{ failure() }} failed, but the solution seems to work for the moment. Thank you for the help!