Github: How can I notify to slack when specific branch is merged into master?

Viewed 2357

I have 3 branches

  • develop
  • master
  • feature

Branch of PR is feature and it gonna be merged into master. However, all branches should be merged into develop before merged into master. But, I forgot this action many times. Therefore, I want notification of Slack before a specific branch is merged into master.

How can I implement this? I searched for Github actions or Slack app, but couldn't find.

4 Answers

You can create your own GitHub action to notify you in Slack when a pull request is created and display the base ref/branch. That way you can see which branch you will be merging into.

Here is a helpful article for creating a custom GitHub action for Slack notifications for pull requests: https://spacejelly.dev/posts/how-to-use-github-actions-to-automate-tests-and-slack-notifications/

Here is the data you can get from the github.event.pull_request object: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#pull_request

It was late, But the answer might help someone else

/github subscribe owner/repo commits:master

You can mention any branch name in the place of master

You can add github to your slack workspace to get updates on different things: https://slack.github.com/

In your channel you go /github subscribe [yourRepo] to activate updates.

/github subscribe owner/repo commits:all

This will subscribe to all the branches

Related