https://github.com/includable/action-slack-notify
https://github.com/includable/action-slack-notify
Last synced: 6 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/includable/action-slack-notify
- Owner: includable
- Created: 2025-06-06T16:00:38.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-06-06T16:19:46.000Z (10 months ago)
- Last Synced: 2025-09-30T05:46:57.882Z (6 months ago)
- Language: JavaScript
- Homepage:
- Size: 271 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Action: Slack notify
This action prints your GitHub Action build status to Slack. It takes an opinionated approach by showing attachments for metadata like branch, pull request, and event.
It is based on [voxmedia/github-action-slack-notify-build](https://github.com/voxmedia/github-action-slack-notify-build), but modified to use incoming webhooks instead of Bot Tokens.
## Usage
```yaml
uses: includable/action-slack-notify@v1
with:
webhook_url: ${{ secrets.SLACK_NOTIFICATIONS_WEBHOOK_URL }}
channel: app-alerts
status: STARTED
color: good
```
The Slack notification leverages attachments to group important information together and provide valuable links:

When used with the `pull_request` event, a link to the originating pull request is included:

### Reporting Success or Failure
You can use the `success()` and `failure()` conditional checks within your workflow to determine which build notification to send:
```yaml
- name: Run tests
# ... your test step here
- name: Notify slack success
if: success()
uses: includable/action-slack-notify@v1
with:
webhook_url: ${{ secrets.SLACK_NOTIFICATIONS_WEBHOOK_URL }}
channel: app-alerts
status: SUCCESS
color: good
- name: Notify slack fail
if: failure()
uses: includable/action-slack-notify@v1
with:
webhook_url: ${{ secrets.SLACK_NOTIFICATIONS_WEBHOOK_URL }}
channel: app-alerts
status: FAILED
color: danger
```
## Inputs
### `status`
**Required** The status to show for the action, e.g. `STARTED` or `FAILED`.
### `webhook_url`
The incoming webhook URL to post the message to. **Required**. You can find this in your Slack app settings under "Incoming Webhooks". It should look like `https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX`.
### `color`
The color to use for the notification. Can be a hex value or any [valid Slack color level](https://api.slack.com/reference/messaging/attachments#fields) (e.g. `good`). Defaults to `#cccccc`.