Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Ilshidur/action-slack

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

Repository files navigation

🚀 Slack for GitHub Actions

All Contributors

Build Status stability-frozen No Maintenance Intended

Sends a Slack notification. Simple as that.

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.


DEPRECATION NOTICE

Please refer to the following discussion : #255

Usage

- name: Slack notification
  env:
    SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
    SLACK_USERNAME: ThisIsMyUsername # Optional. (defaults to webhook app)
    SLACK_CHANNEL: general # Optional. (defaults to webhook)
    SLACK_AVATAR: repository # Optional. can be (repository, sender, an URL) (defaults to webhook app avatar)
  uses: Ilshidur/action-slack@2.0.2
  with:
    args: 'A new commit has been pushed.' # Optional

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

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_WEBHOOK (required): the Slack webhook URL (see https://api.slack.com/incoming-webhooks).
  • SLACK_USERNAME (optional) : overrides username. Defaults to the Slack webhook bot name.
  • 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_AVATAR (optional) : overrides the message avatar. Can be 'repository', 'sender' or an URL. If not set, the avatar of the Slack webhook's bot picture will be used.
  • SLACK_CUSTOM_PAYLOAD (advanced) : JSON string that sets full payload. instructions see CUSTOM_PAYLOAD

Debugging / testing / development

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

Contributors


Christhopher Lion

💻 🤔 📖

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

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

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


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