A GitHub Action to send a message to a Slack channel.
You can use this action after any other action. Here is an example setup of this action:
- Create a
.github/workflows/slack-notify.ymlfile in your GitHub repo. - Add the following code to the
slack-notify.ymlfile.
on: push
name: Notify Slack Demo
jobs:
slackNotification:
name: Notify Slack
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Notify Slack
uses: pmagentur/pm_slack_notifier@v0.1
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}- Create
SLACK_WEBHOOKsecret GitHub Action's Secret. You can generate a Slack incoming webhook token from here.
By default, action is designed to run with minimal configuration but you can alter Slack notification using following environment variables:
You can see the action block with all variables as below:
- name: Slack notifier
uses: pmagentur/pm_slack_notifier@v0.1
env:
SLACK_CHANNEL: deploy-logs
SLACK_COLOR: '#FF0000'
SLACK_ICON: https://avatars1.githubusercontent.com/u/63812035?s=200&v=4
SLACK_MESSAGE: 'Post Content :rocket:'
SLACK_TITLE: 'Post Title'
SLACK_USERNAME: 'PM's whisperer'
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}MIT © 2019 PM Agenture
The project is motivated and forked from the following project