Skip to content

pmagentur/pm-slack-notifier

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

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Slack Notify - GitHub Action

Project Status: Active – The project has reached a stable, usable state and is being actively developed.

A GitHub Action to send a message to a Slack channel.

Usage

You can use this action after any other action. Here is an example setup of this action:

  1. Create a .github/workflows/slack-notify.yml file in your GitHub repo.
  2. Add the following code to the slack-notify.yml file.
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 }}
  1. Create SLACK_WEBHOOK secret GitHub Action's Secret. You can generate a Slack incoming webhook token from here.

Environment Variables

By default, action is designed to run with minimal configuration but you can alter Slack notification using following environment variables:

Variable Default Purpose
SLACK_CHANNEL Set during Slack webhook creation Specify Slack channel in which message needs to be sent
PRIMARY_SLACK_CHANNEL Set during Slack webhook creation You might want to send some of the notifications to primary channel as well instead of "log" channel
SLACK_USERNAME PM's Bot The name of the sender of the message. Does not need to be a "real" username
SLACK_ICON default Avatar User/Bot icon shown with Slack message
SLACK_COLOR good (green) You can pass an RGB value like #efefef which would change color on left side vertical line of Slack message.
SLACK_MESSAGE Generated from git commit message. The main Slack message in attachment. It is advised not to override this.
SLACK_TITLE Message Title to use before main Slack message

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 }}

License

MIT © 2019 PM Agenture

The project is motivated and forked from the following project

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors