How to run steps after a failing step

Scenario:

I have a simple workflow which should do the following:

  • checkout

  • install cypress

  • run cypress

  • upload screenshots done by cypress

My problem is, that the last step of uploading is not done because the cypress failed due to failing tests

is it possible and if, how to run the steps even if previous steps failed?

2 Likes

here you go:

https://help.github.com/en/articles/contexts-and-expression-syntax-for-github-actions#job-status-check-functions

10 Likes

Can I assume by default all steps have an implicit 

if: ${{ success() }}

Yes, https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#job-status-check-functions

You can use the following status check functions as expressions in if conditionals. If your if expression does not contain any of the status functions it will automatically result with success() . For more information about if conditionals, see “Workflow syntax for GitHub Actions.”