Lightweight github action for posting to slack (using node-slack-sdk).
Slack Notifier allows you interact with slack while exposing Github's payload. Pairing with a slack bot, this action is able to post a message when a specific event occurs. This is still in develop phase. New events will be added.
You can use this action after any other action. Here is an example setup of this action:
- Create a
.github/workflows/slack-notifier.ymlfile in your GitHub repo. - Add the following code to the
slack-notifier.ymlfile.
name: Slack Notifier
on:
pull_request:
types: [opened, reopened]
jobs:
send-notification:
runs-on: ubuntu-latest
steps:
- name: Posting to slack
uses: facureyes/slack-notifier@v1.0
with:
slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
channel-id: ${{ secrets.SLACK_CHANNEL_ID }}
event: new_pull_request
jira-base-url: https://example.atlassian.net/
jira-project-acronym: EXPL- Create
SLACK_BOT_TOKENandSLACK_CHANNEL_IDsecret using GitHub Action's Secret. You will need to generate a Slack bot token from here and assign it the appropriate authorization(seeSetting up Actions) and locate the channel ID.
By default, action is designed to run with minimal configuration but you can alter Slack notification using following environment variables:
| Variable | Default | Purpose |
|---|---|---|
| event | new_pull_request |
The event define message template to be used. Currently support new_pull_request. |
| jira-base-url | - | Jira's base url of your organisation. |
| jira-project | - | Jira's project acronym. |
| slack-bot-token | - | Slack bot authentication token |
| channel-id | - | Slack channel to post to, to get the channel id follow this guide |
- Reference
- Add vercel
npm i -g @vercel/ncc
ncc build index.js
git add action.yml index.js dist/index.js node_modules/*
git commit -m "<commit message>"
git tag -a -m "<tag message>" <tag name>
git push --follow-tags
If you'd like to contribute, please fork the repository and use a feature branch. Pull requests are warmly welcome.
- Project homepage: https://github.com/facureyes/slack-notifier
- Repository: https://github.com/facureyes/slack-notifier
- Issue tracker: https://github.com/facureyes/slack-notifier/issues
- In case of sensitive bugs like security vulnerabilities, please contact facundotomasreyes@gmail.com
The code in this project is licensed under MIT license.