Skip to content
at-sign

GitHub Action

Notify to Slack

v2.0.1 Latest version

Notify to Slack

at-sign

Notify to Slack

notify current job status to Slack

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Notify to Slack

uses: kyontan/[email protected]

Learn more about this action in kyontan/slack-notify-action

Choose a version

kyontan/slack-notify-action

Action that notifies workflow status to Slack

Uses slackapi/slack-github-action internally and supports various ways to send.

Please refer above document for setup environment variables.

Notification example

screenshot of notification on success

screenshot of notification on failure

screenshot of notification on cancellation

Usage

Add step using this action at the beginning of all steps.

(This is because the action sends notification in post step, that will not be executed if the main step skipped by the preliminary step failure)

name: build-something

on:
  push: {}

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Send notification to Slack
        uses: kyontan/slack-notify-action@v1
        env:
          SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
          SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
          JOB_STATUS: ${{ job.status }}
      - name: Build something
      - ...

You have to pass JOB_STATUS environment variable in addition to requirements by slackapi/slack-github-action.