A GitHub Action to send a message to a Slack channel.
Here is an example setup of this action:
name: Some Action
on:
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
steps:
...
steps before
...
- name: Slack Notification
uses: AndyKIron/slack-notify@main
with:
channel: some-slack-channel
username: sender-name
message: "tour message here"
slack_webhook: ${{ secrets.SLACK_WEBHOOK }}
...
steps after
...
| Variable | Purpose | |
|---|---|---|
| channel | required | Slack channel name where you want sending message |
| username | required | Message sender name |
| icon_url | optional | URL to an image to use as the icon for this message. |
| status | optional | Message status (left border color). Values - good (green), warning (yellow), danger (red), or any hex color code (eg. #439FE0). Default - good |
| message | required | Message content like "<!channel> :rotating_light: *${{github.actor}}* do some wrong!" (markdown supported) |
| slack_webhook | required | You can generate a Slack incoming webhook token from here. |
- Create
SLACK_WEBHOOKsecret using GitHub Action's Secret.