Skip to content

Commit

Permalink
Merge branch 'main' into v3
Browse files Browse the repository at this point in the history
  • Loading branch information
sonots committed Mar 22, 2024
2 parents c5ceea6 + 54f205f commit c6c00ec
Show file tree
Hide file tree
Showing 9 changed files with 24,623 additions and 25,347 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
3 changes: 2 additions & 1 deletion DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,13 @@ Git push to run GitHub Actions.
$ git push origin pre
```

Send PR from `pre` branch to `main` branch, and merge it.
Send PR from `pre` branch to `main` branch, and merge it.

## How to Release

Update version in package.json.

Send PR from `pre` branch to `main` branch, and merge it.
Send PR from `main` branch to `v3` branch, and merge it.

Add a tag with a release version.
Expand Down
35 changes: 25 additions & 10 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 @@ -57,17 +72,17 @@ Example:

In case of success:

<img width="480" alt="success" src="https://user-images.githubusercontent.com/2290461/71901838-1bdbab00-31a4-11ea-9fde-110b6acdab4e.png" />
<img width="360" alt="success" src="https://user-images.githubusercontent.com/2290461/71901838-1bdbab00-31a4-11ea-9fde-110b6acdab4e.png" />

In case of failure:

<img width="480" alt="failure" src="https://user-images.githubusercontent.com/2290461/71901854-26964000-31a4-11ea-9386-bec251a8a550.png" />
<img width="360" alt="failure" src="https://user-images.githubusercontent.com/2290461/71901854-26964000-31a4-11ea-9386-bec251a8a550.png" />

In case of cancellation:

<img width="480" alt="canceled" src="https://user-images.githubusercontent.com/2290461/71901862-2dbd4e00-31a4-11ea-99ea-9c1b37abe443.png" />
<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 c6c00ec

Please sign in to comment.