Slack Notification Deploys for every commit - we only would like a notification when a PR is merged into main


I set up slack notification for my company’s website to receive when there is a new build started, new build succeeds and a new build fails. This is sent to our marketing-site-build-feed channel.

For build fail we also are sending a notification to our squad specific channel to take action quickly rather than it getting lost in the build feed channel we have all notifications in.

The problem we are having is that Netlify sends a notification for every single commit even for work in progress branches. So if a commit in a branch that is currently in the work fails it will send a notification to our channel and cause a false alarm and we won’t know for certain what is work in progress vs a fail that went live into the main branch.

In summary, is there a way for us to have build notification once a PR is merged into main only? Not for every commit in a working PR?

Not directly @jehovany.cruz, I’m afraid. But could be achievable in a different way. Inside your build script, you can check if the current branch is main: Build environment variables | Netlify Docs and if yes, you will have to trigger a Slack notification yourself.

I’d recommend writing a build plugin for that: Create Build Plugins | Netlify Docs