After a failed step, the steps after it are skipped. Two conditions change that:
yaml
steps:
- uses: actions/checkout@v7
- run: ./test.sh
- if: failure()
run: ./notify.sh "Tests failed"
- if: always()
run: ./notify.sh "CI finished"failure(): true when a step before this one failed. Here, it tells the team.always(): true whatever happened. Here, it reports either way. (It's also how you upload a test report from a run that failed.)
The tests on main fail right now: Sam changed a price. Add the notice first, push, and see it run; then fix the price.
Objectives
- Tell the team when the tests fail.
- Always report.