Skip to content

Commit

Permalink
DevOps: only run Slack notification if tests failed (#819)
Browse files Browse the repository at this point in the history
The workflow was recently adapted to correct the action being marked as
successful even when the tests failed. This was done by removing the
`continue-on-error` option, which ignores the error. To still have the
Slack option run on error, the `if: always()` condition was added. This
works in the case of an error, but it also made that the step would
always run, even when the tests pass just fine. The solution is to keep
the explicit check on the exit status of the install and tests steps.
  • Loading branch information
sphuber authored Jun 7, 2022
1 parent 679fe68 commit 5be0815
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@ name: nightly
on:
schedule:
- cron: '0 0 * * *' # Run every day at midnight
push:
paths:
- '.github/workflows/nightly.yml'
pull_request:
paths:
- '.github/workflows/nightly.yml'


jobs:

tests:
Expand Down Expand Up @@ -53,7 +57,7 @@ jobs:
run: pytest -sv tests

- name: Slack notification
if: always()
if: always() && (steps.install.outcome == 'Failure' || steps.tests.outcome == 'Failure')
uses: rtCamp/action-slack-notify@master
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
Expand Down

0 comments on commit 5be0815

Please sign in to comment.