Skip to content

Post Workflow Status To Slack

Actions
Post workflows Succes/Failure/Cancel jonb status to Slack using bot
v1
Latest
Star (11)

Post Workflow Status To Slack

This action sends message to slack based on Job Status. Gihub action sets the value for Job Status i.e. ${{ job.status }} based on whether step succeeded/failed/cancelled.

Possible values assinged to job status are follows:

  1. Success
  2. Failure
  3. Cancelled

This action sends message using Slack bot tokens.

Inputs

job-status

(Required) The {{ job.status }} used to decide slack message content i.e. status, color

Status Color Hex Color Name
Success #00FF00 Pure Lime Green
Failure #FF0000 Pure Red
Cancelled #EE6F47 Bright Red

slack-bot-token

(Required) The slack bot token required to post slack message

channel

(Required) Slack channel where job status message will be posted

Usage

Here's an example of a workflow which has two jobs:

  1. success-notification: Sends job succeeded message to github-actions-test slack channel

  2. failure-notification: Sends job failed message to github-actions-test slack channel

name: Test

on:
  push:
    branches:
      - master

jobs:
  success-notification:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - run: exit 0
      - name: Slack Success
        if: always()
        uses: kpritam/slack-job-status-action@v1
        with:
          job-status: ${{ job.status }}
          slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
          channel: github-actions-test

  failure-notification:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - run: exit 1
      - name: Slack Failure
        if: always()
        uses: kpritam/slack-job-status-action@v1
        with:
          job-status: ${{ job.status }}
          slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
          channel: github-actions-test

Slack message for build success or failure would look like this:

Slack Bot Setup

This action is inspired from slack-action, follow instruction here for setting up slack bot.

Post Workflow Status To Slack is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

About

Post workflows Succes/Failure/Cancel jonb status to Slack using bot
v1
Latest

Post Workflow Status To Slack is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.