Skip to content

Commit

Permalink
Merge branch 'main' into pre
Browse files Browse the repository at this point in the history
  • Loading branch information
sonots committed Mar 22, 2024
2 parents a87731e + 183d37a commit 55432b0
Show file tree
Hide file tree
Showing 8 changed files with 24,615 additions and 25,340 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
name: Create Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Create Release
id: create_release
uses: actions/create-release@v1
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ jobs:
check_pr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v1
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/uncommitted.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
uncommitted:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
# NOTE: Use node16 on local
- run: npm version
- run: npm ci
Expand Down
29 changes: 22 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,35 @@

Yet Another GitHub Action to notify slack.

## Quick Start

```yaml
- uses: sonots/slack-notice-action@v3
with:
status: ${{ job.status }}
only_mention_fail: 'channel'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Required, but this should be automatically supplied by GitHub.
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # Required. Legacy Incoming Webhook is also supported.
if: always() # Pick up events even if the job fails or is canceled.
```
<img width="360" alt="success" src="https://user-images.githubusercontent.com/2290461/71901838-1bdbab00-31a4-11ea-9fde-110b6acdab4e.png" />
## Usage
### with Parameters
| key | value | default | description |
| ----------------- | ---------------------------------------------------------- | --------------------- | ------------------------------------------|
| status | 'success' or 'failure' or 'cancelled' or 'custom' | '' | Use `${{ job.status }}`. |
| status | `success` or `failure` or `cancelled` or `custom` | '' | Use `${{ job.status }}`. |
| text | any string | '' | `text` field |
| text_on_success | any string | '' | `text` field on success |
| text_on_fail | any string | '' | `text` field on failure |
| text_on_cancel | any string | '' | `text` field on cancellation |
| title | any string | workflow name | `title` field |
| mention | 'here' or 'channel' or user\_id such as `user_id,user_id2` | '' | Mention always if specified. The user ID should be an ID, such as `@U024BE7LH`. See [Mentioning Users](https://api.slack.com/reference/surfaces/formatting#mentioning-users) |
| only_mention_fail | 'here' or 'channel' or user\_id such as `user_id,user_id2` | '' | Mention only on failure if specified |
| mention | `here` or `channel` or user\_id such as `user_id,user_id2` | '' | Mention always if specified. The user ID should be an ID, such as `@U024BE7LH`. See [Mentioning Users](https://api.slack.com/reference/surfaces/formatting#mentioning-users) |
| only_mention_fail | `here` or `channel` or user\_id such as `user_id,user_id2` | '' | Mention only on failure if specified |

Supported by only legacy incoming webhook.

Expand All @@ -38,17 +53,17 @@ Custom notification. See [Custom Notification](https://github.com/sonots/slack-n
| ----------------- | ----- | ---------| ----------------------------------------------------------------------------------------------------------- |
| payload | | '' | Only available when status: custom. The payload format can pass javascript object. |

### Notification
## Example

Example:
Legacy Incoming Webhook Example:

```yaml
- uses: sonots/slack-notice-action@v3
with:
status: ${{ job.status }}
username: Custom Username
icon_emoji: ':octocat:'
channel: '#integration-test'
channel: 'C8UJ12P4P'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Required, but this should be automatically supplied by GitHub.
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # Required. Legacy Incoming Webhook is also supported.
Expand All @@ -67,7 +82,7 @@ In case of cancellation:

<img width="360" alt="canceled" src="https://user-images.githubusercontent.com/2290461/71901862-2dbd4e00-31a4-11ea-99ea-9c1b37abe443.png" />

### Custom Notification
## Example: Custom Notification

Use `status: custom` if you want to send an arbitrary payload.
The payload format can pass javascript object.
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ inputs:
description: override the legacy integration's default channel. This should be an ID, such as C8UJ12P4P.
default: ''
runs:
using: node16
using: node20
main: dist/index.js
branding:
icon: bell
Expand Down
Loading

0 comments on commit 55432b0

Please sign in to comment.