ravsamhq / notify-slack-action

🔔 Send a Slack Notification from Github Actions regarding failure, warnings, or even success.
https://ravsam.in/blog/send-slack-notification-when-github-actions-fails/
MIT License
173 stars 57 forks source link

`notify_when: failure` doesn't send the message to Slack in case of failure #37

Closed jodosha closed 2 years ago

jodosha commented 2 years ago

Hey thanks for this project.

I had notify_when: failure to avoid being flooded by several OSS repositories that are run daily via GitHub Actions cron. So I want only to know when scheduled CI fails.

Yesterday, the cron scheduled GHA failed, but I didn't get any notification on Slack.

Here's my configuration: https://github.com/hanami/controller/blob/f2c1844a2ee57aeeba4e8641006349e0b23c732d/.github/workflows/ci.yml

ravgeetdhillon commented 2 years ago

@jodosha You need to add the notify slack step at the very last so that if any of the preceding steps fail, Github Actions knows to run the step specified with if: always().

Let me know if this solution works for you.

ravgeetdhillon commented 2 years ago

@jodosha I hope this solved your issue. Let me know if you have any questions. I'm closing this for now.

jodosha commented 2 years ago

@ravgeetdhillon Hey yes, it works! Thanks. I waited for a failure on our CI before to give this confirmation. 🙂