Skip to content

includable/action-slack-notify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Action: Slack notify

This action prints your GitHub Action build status to Slack. It takes an opinionated approach by showing attachments for metadata like branch, pull request, and event.

It is based on voxmedia/github-action-slack-notify-build, but modified to use incoming webhooks instead of Bot Tokens.

Usage

uses: includable/action-slack-notify@v1
with:
  webhook_url: ${{ secrets.SLACK_NOTIFICATIONS_WEBHOOK_URL }}
  channel: app-alerts
  status: STARTED
  color: good

The Slack notification leverages attachments to group important information together and provide valuable links:

Screenshot of the push event

When used with the pull_request event, a link to the originating pull request is included:

Screenshot of the pull_request event

Reporting Success or Failure

You can use the success() and failure() conditional checks within your workflow to determine which build notification to send:

- name: Run tests
  # ... your test step here
- name: Notify slack success
  if: success()
  uses: includable/action-slack-notify@v1
  with:
    webhook_url: ${{ secrets.SLACK_NOTIFICATIONS_WEBHOOK_URL }}
    channel: app-alerts
    status: SUCCESS
    color: good

- name: Notify slack fail
  if: failure()
  uses: includable/action-slack-notify@v1
  with:
    webhook_url: ${{ secrets.SLACK_NOTIFICATIONS_WEBHOOK_URL }}
    channel: app-alerts
    status: FAILED
    color: danger

Inputs

status

Required The status to show for the action, e.g. STARTED or FAILED.

webhook_url

The incoming webhook URL to post the message to. Required. You can find this in your Slack app settings under "Incoming Webhooks". It should look like https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX.

color

The color to use for the notification. Can be a hex value or any valid Slack color level (e.g. good). Defaults to #cccccc.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published