This guide provides a straightforward process to install the GitHub app on your Slack workspace and configure it to receive real-time commit notifications for a specified branch of your GitHub repository. Stay updated on your team's development progress directly within your Slack channels.
Part 1: Install the GitHub App on Slack
- Go to the GitHub Slack Integration Page: Open your web browser and navigate to https://slack.github.com/.
- Add to Slack: Click on the "Add to Slack" button.
- Authorize Slack: You'll be prompted to sign in to your Slack workspace and authorize the GitHub app to access it. Select the workspace where you want to add the integration and click "Authorize."
- Connect GitHub Account: After authorizing Slack, you'll need to connect your GitHub account. Click "Connect GitHub account" and log in with your GitHub credentials.
- Grant Permissions: Review the permissions the app requests (e.g., access to repositories, commit data, webhook events) and grant permission. It's recommended to share only the necessary information for security.
- Configure in Slack: Once the app is installed, the GitHub app will send you a direct message in Slack with instructions on how to use the
/github
slash command.
Part 2: Subscribe to a Specified Branch for Commit Notifications
- Go to the Desired Slack Channel: Open Slack and navigate to the channel where you want to receive GitHub commit notifications.
- Subscribe to the Repository: In the Slack channel, type the following command to subscribe to a repository:
Replace/github subscribe username/reponame
username
with the GitHub username or organization name andreponame
with the name of the repository. For example:/github subscribe my-org/my-repo
.By default, this will subscribe you to notifications for issues, pull requests, commits on the default branch (usually
main
), releases, and deployments. - Subscribe to Commits on a Specific Branch: To get commit notifications for a specified branch (not just the default branch), use the following command:
Replace/github subscribe username/reponame commits:branch_name
username/reponame
with your repository details andbranch_name
with the specific branch you want to monitor. For example:/github subscribe my-org/my-repo commits:develop
.- To subscribe to all commits across all branches, you can use:
/github subscribe username/reponame commits:*
- To subscribe to all commits across all branches, you can use:
Important Notes:
- Ensure you have the necessary permissions in both GitHub and Slack to perform these actions (e.g., administrator or owner roles).
- You can customize notifications further using the
/github settings
command, which allows you to enable or disable specific event types (e.g.,reviews
,comments
,branches
). - If you encounter issues, review your Slack logs or reauthorize GitHub access.