Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/raulanatol/slack-message-github-action
Github action to sent messages to slack
https://github.com/raulanatol/slack-message-github-action
Last synced: 2 months ago
JSON representation
Github action to sent messages to slack
- Host: GitHub
- URL: https://github.com/raulanatol/slack-message-github-action
- Owner: raulanatol
- License: mit
- Created: 2020-04-05T10:56:22.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-09-10T11:39:58.000Z (over 2 years ago)
- Last Synced: 2024-09-13T20:06:25.124Z (3 months ago)
- Language: JavaScript
- Size: 2.05 MB
- Stars: 6
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Slack Messages
This action provide a way to sent messages to Slack.
## Inputs
| Key | Description | Required | |
| --- | ----------- | -------- | -- |
| `WEBHOOK_URL` | The Slack webhook URL | **TRUE** | |
| `SLACK_CHANNEL` | The channel that receives the message | **TRUE** | |
| `MESSAGE` | Message of the notification | **TRUE** | |
| `STATUS` | Used to draw the color of the message status | **FALSE** | Use `${{job.status}}` |## Example usage
Create the file `workflow.yml` in `.github/workflows` folder.
```
name: Slack Message after build
on [push]jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3- uses: raulanatol/[email protected]
env:
WEBHOOK_URL: ${{secrets.SLACK_WEBHOOK_URL}}
SLACK_CHANNEL: ${{secrets.SLACK_NOTIFICATION_CHANNEL}}
MESSAGE: Compilation ends
STATUS: ${{job.status}}
```## Send Slack message only when jobs failed
```
name: Slack Message after job fail
on [push]jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3- uses: raulanatol/[email protected]
env:
WEBHOOK_URL: ${{secrets.SLACK_WEBHOOK_URL}}
SLACK_CHANNEL: ${{secrets.SLACK_NOTIFICATION_CHANNEL}}
MESSAGE: Compilation ends
STATUS: ${{job.status}}
if: failure()
```