This is Slack Notification Action.
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.
- 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
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.
- name: Slack Notification
uses: ilhamsyahids/slackify@v1.1.0
if: always()
with:
type: ${{ job.status }}
job_name: '*Test*'
url: ${{ secrets.SLACK_WEBHOOK }}
- 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 }}
- 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
- 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
- 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