Skip to content

lazy-actions/slatify

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

Slatify

Build Test GitHub release (latest by date) GitHub code style: prettier

This is Slack Notification Action.

Announcement

🚨 Transferred repository from homoluctus 🚨

We don't need to rename from homoluctus/slatify to lazy-actions/slatify in .github/workflow/*.yml. You can use as it is, but we recommend renaming it to lazy-actions/slatify.

ToC

Feature

  • Notify the result of GitHub Actions
  • 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

First of all, you need to set GitHub secrets for SLACK_WEBHOOK that is Incoming Webhook URL.
You can customize 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
We recommend using ${{ job.status }}
job_name required N/A Means slack notification title
url required N/A Slack Incoming Webhooks URL
Please specify this key or SLACK_WEBHOOK environment variable
※SLACK_WEBHOOK will be deprecated
mention optional N/A Slack message mention
mention_if optional N/A The condition to mention
This parameter can contain the following word:
- success
- failure
- cancelled
- always
icon_emoji optional Use Slack Incoming Webhook configuration Slack icon
username optional Use Slack Incoming Webhook configuration Slack username
channel optional Use Slack Incoming Webhook configuration Slack channel name
commit optional false If true, slack notification includes the latest commit message and author.
token case by case N/A This token is used to get commit data.
If commit parameter is true, this parameter is required.
${{ secrets.GITHUB_TOKEN }} is recommended.

Please refer to action.yml for more details.

Examples

Basic usage

- name: Slack Notification
  uses: lazy-actions/slatify@master
  if: always()
  with:
    type: ${{ job.status }}
    job_name: '*Test*'
    channel: '#random'
    url: ${{ secrets.SLACK_WEBHOOK }}

Includes the latest commit information

- name: Slack Notification
  uses: lazy-actions/slatify@master
  if: always()
  with:
    type: ${{ job.status }}
    job_name: '*Lint Check*'
    mention: 'here'
    mention_if: 'failure'
    channel: '#random'
    url: ${{ secrets.SLACK_WEBHOOK }}
    commit: true
    token: ${{ secrets.GITHUB_TOKEN }}

Slack UI

Notification Preview


Notification Preview

LICENSE

The MIT License (MIT)