Danuphon / action-slack

πŸš€ GitHub Action that sends a Slack notification.

Home Page:https://github.com/marketplace/actions/github-action-for-slack

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

πŸš€ Slack for GitHub Actions

Build Status

Sends a Slack notification. Simple as that.

GitHub Action

Appearance on Slack :

Slack message

This GitHub action is part of a list of Actions that are located in an other repo. Feel free to check it out : https://github.com/Ilshidur/actions.


Usage

New YML syntax

- name: Slack notification
  env:
    SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
    SLACK_USERNAME: ThisIsMyUsername # Optional.
    SLACK_CHANNEL: general # Optional.
    SLACK_OVERRIDE_MESSAGE: 'Custom message' # Optional.
  uses: Ilshidur/action-slack@master
  with:
    args: 'A new commit has been pushed.'

(legacy) HCL syntax

action "Slack notification" {
  uses = "Ilshidur/action-slack@master"
  secrets = ["SLACK_WEBHOOK"]
  args = "A new commit has been pushed."
}

NOTICE : for stability purposes, it is recommended to use the action with an explicit commit SHA-1 :

Ilshidur/action-slack@9273a03 (=> link to the commits list : https://github.com/Ilshidur/action-slack/commits/master)

Arguments

The argument is the message to display in the Slack notification.

Environment variables can be interpolated in the message using brackets ({{ and }}) :

e.g.: Action called : {{ GITHUB_ACTION }}

Note : be careful to properly format your messages for Slack.

Event Payload data can also be interpolated in the message using brackets ({{ and }}) with the EVENT_PAYLOAD variable.

e.g.: Action called: {{ GITHUB_ACTION }} as {{ EVENT_PAYLOAD.pull_request.id }}

See the event types for valid payload informations.

Examples

  • args: "Hello, beautiful ! I ran a GitHub Action for you <3"
  • args: "I showed you my commit. Please respond."

Environment variables

  • SLACK_USERNAME (optional) : overrides the default username. Defaults to the name of the Action.
  • SLACK_CHANNEL (optional) : overrides the default channel of the webhook. If not set, the message will be sent to the channel associated to the webhook.
  • SLACK_OVERRIDE_MESSAGE (optional boolean, defaults to nothing) : set to true to remove the first line of the message (<author>/<project>/Deployment triggered by <author> (push) :). Any other value will override the message set in the args of this Action.

Secrets

Debugging / testing / development

Developers, all you need is in the DEVELOPMENT.md file.

Alternatives

Because open source is about everyone :

https://github.com/marketplace/actions/post-slack-message

https://github.com/marketplace/actions/slack-notify

https://github.com/marketplace/actions/slack-bot-action

https://github.com/marketplace/actions/slatify


Don't forget to 🌟 Star 🌟 the repo if you like this GitHub Action !
Your feedback is appreciated

About

πŸš€ GitHub Action that sends a Slack notification.

https://github.com/marketplace/actions/github-action-for-slack

License:MIT License


Languages

Language:JavaScript 79.9%Language:Dockerfile 20.1%