Code Monkey home page Code Monkey logo

action-slack's Introduction

🚀 Slack for GitHub Actions

All Contributors

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.

Compatibility note

As this Action is containerized with Docker, it can only run on Linux environments.

Docker container actions can only execute in the GitHub-hosted Linux environment.

Self-hosted runners must use a Linux operating system and have Docker installed to run Docker container actions. For more information about the requirements of self-hosted runners, see "About self-hosted runners."


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@master
  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 :

Ilshidur/action-slack@fb92a78 (=> 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_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


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

action-slack's People

Contributors

allcontributors[bot] avatar dependabot[bot] avatar hawler avatar ilshidur avatar itsmelion avatar jpalumickas avatar mikeseese avatar renovate-bot avatar renovate[bot] avatar tsnolan23 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.