Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/8398a7/action-slack
Provides the function of slack notification to GitHub Actions.
https://github.com/8398a7/action-slack
github-actions slack typescript
Last synced: 6 days ago
JSON representation
Provides the function of slack notification to GitHub Actions.
- Host: GitHub
- URL: https://github.com/8398a7/action-slack
- Owner: 8398a7
- License: mit
- Created: 2019-08-15T15:14:40.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-10-10T09:00:17.000Z (4 months ago)
- Last Synced: 2024-10-29T17:24:02.474Z (3 months ago)
- Topics: github-actions, slack, typescript
- Language: TypeScript
- Homepage: https://action-slack.netlify.app/
- Size: 6.22 MB
- Stars: 586
- Watchers: 5
- Forks: 133
- Open Issues: 31
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- awesome-github-repos - 8398a7/action-slack - Provides the function of slack notification to GitHub Actions. (TypeScript)
README
# action-slack
[![Netlify Status](https://api.netlify.com/api/v1/badges/a132b9a0-3a80-4938-afa6-2cad038a14a9/deploy-status)](https://app.netlify.com/sites/action-slack/deploys)
![](https://github.com/8398a7/action-slack/workflows/test-build/badge.svg)
![](https://github.com/8398a7/action-slack/workflows/Slack%20Mainline/badge.svg)
![](https://img.shields.io/github/license/8398a7/action-slack?color=brightgreen)
![](https://img.shields.io/github/v/release/8398a7/action-slack?color=brightgreen)
[![codecov](https://codecov.io/gh/8398a7/action-slack/branch/master/graph/badge.svg)](https://codecov.io/gh/8398a7/action-slack)- [Document](https://action-slack.netlify.app)
## Quick Start
You can learn more about it [here](https://action-slack.netlify.app/usecase/01-general).
```yaml
steps:
- uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
fields: repo,message,commit,author,action,eventName,ref,workflow,job,took,pullRequest # selectable (default: repo,message)
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required
if: always() # Pick up events even if the job fails or is canceled.
```## Custom Formats of your choice
You can learn more about it [here](https://action-slack.netlify.app/usecase/02-custom).
```yaml
steps:
- uses: 8398a7/action-slack@v3
with:
status: custom
fields: workflow,job,commit,repo,ref,author,took
custom_payload: |
{
attachments: [{
color: '${{ job.status }}' === 'success' ? 'good' : '${{ job.status }}' === 'failure' ? 'danger' : 'warning',
text: `${process.env.AS_WORKFLOW}\n${process.env.AS_JOB} (${process.env.AS_COMMIT}) of ${process.env.AS_REPO}@${process.env.AS_REF} by ${process.env.AS_AUTHOR} ${{ job.status }} in ${process.env.AS_TOOK}`,
}]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
if: always() # Pick up events even if the job fails or is canceled.
```## For GitHub Enterprise
```yaml
steps:
- uses: 8398a7/action-slack@v3
with:
github_base_url: https://your.ghe.com # Specify your GHE
status: ${{ job.status }}
fields: repo,message,commit,author,action,eventName,ref,workflow,job,took,pullRequest
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
if: always()
```## Require Permissions
If you are explicitly specifying permissions, must grant `contents` and `actions`.
```yaml
permissions:
contents: read
actions: read
```