Skip to content

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

License

Notifications You must be signed in to change notification settings

chussum/action-slack-notification

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

Action Slack Notification

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.

Screenshot

capture

Usage

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

  1. Create a .github/workflows/slack-workflow.yml file in your GitHub repo.
  2. Add the following code to the slack-workflow.yml file.
on: push
name: Slack Notification
jobs:
  slack:
    name: Slack Notification
    runs-on: ubuntu-latest
    steps:
      - name: Slack Notification
        if: always() # Pick up events even if the job fails or is canceled.
        uses: chussum/action-slack-notification@v1
        with:
          status: ${{ job.status }}
          fields: repo,commit # selectable (default: repo,commit,action)
          hash: 2e133437d3f8518b16b5f92d7906fe1e5b4d6b88 # optional, Github commit sha (will be display in fields (default. github ref))
          success_text: Succeeded # optional, Slack message when succeeded.
          failure_text: Failed # optional, Slack message when succeeded.
          canceled_text: Canceled # optional, Slack message when succeeded.
          bot_name: Hello World Bot # legacy optional, Override the legacy integration's default name.
          channel: general # legacy optional, Override the legacy integration's default channel.
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # required
          SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required
  1. Create SLACK_WEBHOOK_URL secret using GitHub Action's Secret. You can generate a Slack incoming webhook token from here.

License

MIT © 2021 chussum

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 74.5%
  • JavaScript 25.5%