Setting up Slack alerts for specific PR merges in GitHub

Hey everyone! I’m having trouble with my GitHub and Slack setup. I want Slack to notify me when a pull request is merged into a release branch, but it’s not working as expected.

I tried this command:

/github subscribe mycompany/project workflows:{event:"pull_request.closed" base:"RELEASE-*"}

However, I received no notifications. In contrast, when I use:

/github subscribe mycompany/project pulls

I end up with too many alerts. Does anyone know how to configure Slack so it only alerts for merged PRs on release branches? Thanks for any help!

I’ve encountered similar issues before. The key is to use more specific filters in your subscription command. Here’s what worked for me:

/github subscribe mycompany/project pulls:{base:“RELEASE-*”,action:“closed”,merged:true}

This command filters for closed pull requests that were actually merged into branches starting with ‘RELEASE-’. It should significantly reduce noise while ensuring you get the notifications you need.

Remember to test it thoroughly after setting up. Sometimes GitHub’s webhook delivery can be delayed, so give it some time before concluding it’s not working. If you’re still having trouble, double-check your Slack app permissions and GitHub repository settings.

hey jackhero, try this command instead:

/github subscribe mycompany/project pulls:{base:“RELEASE-*”,action:“closed”,merged:true}

this should filter for merged PRs on release branches only. let me kno if it works for ya!

I’ve dealt with this exact problem in my team’s workflow. Here’s what finally worked for us:

/github subscribe mycompany/project pulls:{base:“RELEASE-*”,state:“closed”,merged:“true”}

This command specifically targets merged PRs on release branches. We found that using ‘state:“closed”’ instead of ‘action:“closed”’ was more reliable.

Also, make sure your Slack app has the necessary permissions in GitHub. We had to update our app’s permissions to include ‘pull_request’ events.

If you’re still not getting notifications, try unsubscribing completely and then resubscribing with the new command. Sometimes that clears up any lingering issues.

Hope this helps solve your notification problem!