logo Axolo
Published on Thursday, September 30, 2021, last updated

How to Set Up GitHub Actions Notifications in Slack: A 2023 Guide for Engineers

Authors

Setting up GitHub Action notifications in Slack

For the past years, as most engineering teams on GitHub, you may have integrated GitHub Actions and workflows in your routine. GitHub Actions are great for continuous integration, continuous deployment, and monitoring your workflows.

In order to receive the right information in your Slack, there are two possibilities to set up notifications for GitHub Actions. The first one is to implement a GitHub Action in your repositories and that will use the Slack API with a OAuth token, the second one is to install an application with a user interface to set up your notifications. We’re going to explain the best of both worlds in this article.

Sydney, CTO @ Axolo, explaining in video how to set up GitHub Action notifications in Slack

Table of Contents

Axolo, a user interface to receive GitHub Action in Slack and much more

Pull request GitHub Action and pull request checks

Axolo’s first feature is to create a single-purpose ephemeral channel for each pull request in Slack. Then, we send every notification related to the pull request in this specific channel, so GitHub actions too!

After installation, you will be able to receive every GitHub Action notification in a pull request channel in Slack (notifying only the pull request creators and reviewers).

But it is not only about GitHub Action, you will also passively receive updates for your branch conflict, pull request checks, and deployments in their specific channel. From the app, you can select only the status you'd like to receive (success, error, ...).

Axolo PR checks

Axolo is a Slack app to help techteams review pull request seamlessly

Three open-source GitHub Action for Slack notifications

During our research, we’ve found four applications on the GitHub marketplace to set up GitHub Action notifications to Slack. We decided to focus on the top three that had more than 100 stars at the time of the article.

Slack notify

This application was created by rtCamp and has 874 stars on GitHub. They developed two other applications for GitHub Action: PHPCS Code Review and Deploy WordPress.

Their API is well-documented and explained. Optionally, Slack notify can support Hashicorp Vault too.

How to use it:

    - name: Slack Notification
      uses: rtCamp/action-slack-notify@v2
      env:
        SLACK_CHANNEL: general
        SLACK_COLOR: ${{ job.status }} # or a specific color like 'good' or '#ff00ff'
        SLACK_ICON: https://github.com/rtCamp.png?size=48
        SLACK_MESSAGE: 'Post Content :rocket:'
        SLACK_TITLE: Post Title
        SLACK_USERNAME: rtCamp
        SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
Slack Notify

From there, you can easily add this setup to any of your current GitHub Action and ask Slack notify to send you notifications in a dedicated channel.

GitHub Action for Slack

GitHub Action for Slack was developed by Nicolas Coutin and Christoper Lion and has currently 197 stars on GitHub. The API is well documented too but messages are pretty simple and do not fully use Slack attachment API.

How to use it:

- name: Slack notification
  env:
    SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
    SLACK_USERNAME: ThisIsMyUsername # Optional. (defaults to webhook app)
    SLACK_CHANNEL: general # Optional. (defaults to webhook)
    SLACK_AVATAR: repository # Optional. can be (repository, sender, an URL) (defaults to webhook app avatar)
  uses: Ilshidur/action-slack@2.0.2
  with:
    args: 'A new commit has been pushed.' # Optional
Example:
GitHub Action for Slack

Action Slack

action-slack was developed by 8398a7 and other contributors and has currently 530 stars on GitHub.

We love the online documentation and the overall rich attachment interface, even if a quick design on the default appearance could be beneficial. But this is the only one to provide a way to customize the appearance of the notifications and they support GitHub Enterprise too!

Example:
steps:
  - uses: 8398a7/action-slack@v3
    with:
      status: ${{ job.status }}
      fields: repo,message,commit,author,action,eventName,ref,workflow,job,took # selectable (default: repo,message)
    env:
      SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required
    if: always() # Pick up events even if the job fails or is canceled.
Example:
Action Slack

In conclusion, setting up notifications for GitHub Actions in Slack can greatly improve your workflow and keep your team informed of important updates. There are several ways to do this, including using out-of-the-box third-party applications like Axolo or one of the open-source GitHub Actions for Slack notifications that you need to set up. Whether you're a software engineer or a project manager, having timely notifications can help you stay on top of your tasks and make informed decisions. So give it a try and see how it can benefit your team!

If you know any other great integrations for GitHub Action in Slack, let us know and we will update the article!