How to notify when a job fails after pushing to the main branch?

By default GitHub sends notifications when a build job fails on a pull request. However, if the main branch fails to build after merging a PR, it does not notify anyone. This is a major problem, since it means failures in the main branch are not noticed until someone manually checks the Actions log. Is it possible to enable notifications for any failures on the main branch only? I don’t want to be spammed with the failure reports for every single branch.

You could add an step that only triggers if you are on the main branch, to send a notification.