Skip to content

ilhamsyahids/slackify

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

Slacktify

GitHub Super-Linter Check dist/ CI

GitHub Marketplace Release Coverage License

This is Slack Notification Action.

Background

This repository is a fork of the original lazy-actions/slatify repository. The original repository has not been updated for a long time (since 2021). Therefore, we have decided to create new Action to ensure that the feature remains available and up-to-date.

This new Action retains the core functionality of the original while incorporating updated dependencies, fixing some issues, and implementing minor adjustments to align with recent changes in the GitHub Actions environment, such as this update.

Table of Contents

Feature

  • Notify the result of GitHub Actions to Slack
  • Support three job status (reference: job-context)
    • success
    • failure
    • cancelled
  • Mention
    • Notify message to channel members efficiently
    • You can specify the condition to mention

Inputs

You need to set input with with the following parameters:

with parameter required/optional default description
type required N/A The result of GitHub Actions job
This parameter value must contain the following word:
- success
- failure
- cancelled
Recommend: ${{ job.status }}
job_name required N/A Slack notification title
url required N/A Slack Incoming Webhooks URL
mention optional N/A Slack message mention
mention_if optional N/A The condition to mention
This parameter can contain the following word:
- always
- success
- failure
- cancelled
icon_emoji optional Use Slack Incoming Webhook configuration Legacy Information Slack icon
username optional Use Slack Incoming Webhook configuration Legacy Information Slack username
channel optional Use Slack Incoming Webhook configuration Legacy Information Slack channel name
commit optional false If true, slack notification includes the latest commit message and author.
token optional ${{ github.token }} This token is used to get commit data.

Please refer to action.yml for more details.

Examples

Basic usage

- name: Slack Notification
  uses: ilhamsyahids/slackify@v1.1.0
  if: always()
  with:
    type: ${{ job.status }}
    job_name: '*Test*'
    url: ${{ secrets.SLACK_WEBHOOK }}

Mention if failure

- name: Slack Notification
  uses: ilhamsyahids/slackify@v1.1.0
  if: always()
  with:
    type: ${{ job.status }}
    job_name: '*Lint Check*'
    mention: 'here'
    mention_if: 'failure' # Mention if job status is failure
    url: ${{ secrets.SLACK_WEBHOOK }}

Includes commit information

- name: Slack Notification
  uses: ilhamsyahids/slackify@v1.1.0
  if: always()
  with:
    type: ${{ job.status }}
    job_name: '*Lint Check*'
    mention: 'here'
    mention_if: 'failure'
    url: ${{ secrets.SLACK_WEBHOOK }}
    commit: true # Include commit information

Legacy Information

- name: Slack Notification
  uses: ilhamsyahids/slackify@v1.1.0
  if: always()
  with:
    type: ${{ job.status }}
    job_name: '*Lint Check*'
    mention: 'here'
    mention_if: 'failure'
    icon_emoji: ':github:' # Slack icon
    username: 'GitHub Actions' # Slack username
    channel: '#general' # Slack channel
    url: ${{ secrets.SLACK_WEBHOOK }}
    commit: true

Override default token

- name: Slack Notification
  uses: ilhamsyahids/slackify@v1.1.0
  if: always()
  with:
    type: ${{ job.status }}
    job_name: '*Lint Check*'
    mention: 'here'
    mention_if: 'failure'
    url: ${{ secrets.SLACK_WEBHOOK }}
    commit: true
    token: ${{ secrets.PRIVATE_TOKEN }} # Override default token

Slack UI

Notification Preview

LICENSE

The MIT License (MIT)