-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 8623b89
Showing
18 changed files
with
15,405 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: TS Lint Check | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
paths: | ||
- src/* | ||
pull_request: | ||
branches: | ||
- master | ||
paths: | ||
- src/* | ||
|
||
jobs: | ||
lint: | ||
name: Lint Check | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- uses: actions/checkout@master | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: '10.x' | ||
|
||
- name: Setup TS | ||
run: npm install tslint typescript -g | ||
|
||
- name: Lint check with tslint | ||
run: tslint './src/*.ts' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Prepare for release | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
|
||
jobs: | ||
release: | ||
name: Build production | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- uses: actions/checkout@v1 | ||
|
||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: '10.x' | ||
|
||
- name: Create Release | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: ${{ github.ref }} | ||
draft: 'false' | ||
prerelease: 'false' | ||
|
||
- name: Rocket.Chat Notification | ||
uses: RocketChat/Rocket.Chat.GitHub.Action.Notification@master | ||
if: always() | ||
with: | ||
type: ${{ job.status }} | ||
job_name: ':rocket: *Publish new release ${{ github.ref }}*' | ||
channel: '#develop' | ||
url: ${{ secrets.ROCKETCHAT_WEBHOOK }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
name: Check notification | ||
|
||
on: [pull_request, push] | ||
|
||
jobs: | ||
success: | ||
name: Works properly | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- uses: actions/checkout@master | ||
|
||
- name: Rocket.Chat Notification | ||
uses: ./ | ||
if: always() | ||
with: | ||
type: ${{ job.status }} | ||
job_name: ':robot_face: *Success*' | ||
mention: 'here' | ||
mention_if: 'failure' | ||
channel: '#develop' | ||
url: ${{ secrets.ROCKETCHAT_WEBHOOK }} | ||
|
||
success_no_mention: | ||
name: Works properly without mention | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- uses: actions/checkout@master | ||
|
||
- name: Rocket.Chat Notification | ||
uses: ./ | ||
if: always() | ||
with: | ||
type: ${{ job.status }} | ||
job_name: ':robot_face: *Success no mention*' | ||
channel: '#develop' | ||
url: ${{ secrets.ROCKETCHAT_WEBHOOK }} | ||
|
||
failure: | ||
name: Works failed | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- uses: actions/checkout@master | ||
|
||
- name: Forced failure | ||
run: exit 1 | ||
|
||
- name: Rocket.Chat Notification | ||
uses: ./ | ||
if: failure() | ||
with: | ||
type: ${{ job.status }} | ||
job_name: ':robot_face: *Failure*' | ||
mention: 'here' | ||
mention_if: 'failure' | ||
channel: '#develop' | ||
url: ${{ secrets.ROCKETCHAT_WEBHOOK }} | ||
|
||
- name: Check if work properly | ||
if: failure() | ||
run: | | ||
echo 'Rocket.Chat failure notification succeeded' | ||
exit 0 | ||
cancel: | ||
# You have to cancel this job | ||
name: Works canceled | ||
runs-on: ubuntu-18.04 | ||
needs: success | ||
timeout-minutes: 1 | ||
steps: | ||
- uses: actions/checkout@master | ||
|
||
- name: Wait | ||
run: sleep 70 | ||
|
||
- name: Rocket.Chat Notification | ||
uses: ./ | ||
if: cancelled() | ||
with: | ||
type: ${{ job.status }} | ||
job_name: ':robot_face: *Cancel*' | ||
mention: 'here' | ||
mention_if: 'always' | ||
channel: '#develop' | ||
url: ${{ secrets.ROCKETCHAT_WEBHOOK }} | ||
|
||
- name: Check if work properly | ||
if: cancelled() | ||
run: | | ||
echo 'Rocket.Chat cancelled notification succeeded' | ||
exit 0 | ||
commit: | ||
name: Include commit data | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- uses: actions/checkout@master | ||
|
||
- uses: ./ | ||
with: | ||
type: ${{ job.status }} | ||
job_name: ':robot_face: *Commit*' | ||
channel: '#develop' | ||
url: ${{ secrets.ROCKETCHAT_WEBHOOK }} | ||
commit: 'true' | ||
token: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.node_repl_history | ||
.config/ | ||
.npm/ | ||
node_modules/ | ||
package-lock.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"printWidth": 200, | ||
"tabWidth": 4, | ||
"useTabs": true, | ||
"semi": true, | ||
"singleQuote": true, | ||
"trailingComma": "none", | ||
"bracketSpacing": false, | ||
"arrowParens": "avoid", | ||
"parser": "typescript" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
The MIT License (MIT) | ||
|
||
Copyright (c) 2018 GitHub, Inc. and contributors | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
# Rocket.Chat.GitHub.Action.Notification | ||
|
||
 | ||
 | ||
 | ||
|
||
This is Rocket.Chat Notification for GitHub Actions.<br> | ||
Generated from [actions/javascript-template](https://github.com/actions/javascript-template). | ||
|
||
# Feature | ||
- Notify the result of GitHub Actions | ||
- Support three job status (reference: [job-context](https://help.github.com/en/articles/contexts-and-expression-syntax-for-github-actions#job-context)) | ||
- success | ||
- failure | ||
- cancelled | ||
- Mention | ||
- Notify message to channel members efficiently | ||
- You can specify the condition to mention | ||
|
||
# How to use | ||
First of all, you need to set GitHub secrets for ROCKETCHAT_WEBHOOK that is Incoming Webhook URL.<br> | ||
You can customize the following parameters: | ||
|
||
|with parameter|required/optional|default|description| | ||
|:--:|:--:|:--|:--| | ||
|type|required|N/A|The result of GitHub Actions job<br>This parameter value must contain the following word:<br>- `success`<br>- `failure`<br>- `cancelled`<br>We recommend using ${{ job.status }}| | ||
|job_name|required|N/A|Means rocket.chat notification title| | ||
|url|required|N/A|Rocket.Chat Incoming Webhooks URL<br>Please specify this key or ROCKETCHAT_WEBHOOK environment variable<br>※ROCKETCHAT_WEBHOOK will be deprecated| | ||
|mention|optional|N/A|Rocket.Chat message mention| | ||
|mention_if|optional|N/A|The condition to mention<br>This parameter can contain the following word:<br>- `success`<br>- `failure`<br>- `cancelled`<br>- `always`| | ||
|icon_emoji|optional|Use Rocket.Chat Incoming Webhook configuration|Rocket.Chat icon| | ||
|username|optional|Use Rocket.Chat Incoming Webhook configuration|Rocket.Chat username| | ||
|channel|optional|Use Rocket.Chat Incoming Webhook configuration|Rocket.Chat channel name| | ||
|commit|optional|false|If true, Rocket.Chat notification includes the latest commit message and author.| | ||
|token|case by case|N/A|This token is used to get commit data.<br>If commit parameter is true, this parameter is required.<br>${{ secrets.GITHUB_TOKEN }} is recommended.| | ||
|
||
Please refer `action.yml` for more details. | ||
|
||
## Examples | ||
|
||
```..github/workflows/example1.yml | ||
- name: Rocket.Chat Notification | ||
uses: RocketChat/Rocket.Chat.GitHub.Action.Notification@master | ||
if: always() | ||
with: | ||
type: ${{ job.status }} | ||
job_name: '*Lint Check*' | ||
mention: 'here' | ||
mention_if: 'failure' | ||
channel: '#random' | ||
url: ${{ secrets.ROCKETCHAT_WEBHOOK }} | ||
``` | ||
|
||
↓ Including the latest commit data | ||
|
||
```..github/workflows/example2.yml | ||
- name: Rocket.Chat Notification | ||
uses: RocketChat/Rocket.Chat.GitHub.Action.Notification@master | ||
if: always() | ||
with: | ||
type: ${{ job.status }} | ||
job_name: '*Lint Check*' | ||
mention: 'here' | ||
mention_if: 'failure' | ||
channel: '#random' | ||
url: ${{ secrets.ROCKETCHAT_WEBHOOK }} | ||
commit: true | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
``` | ||
|
||
# Rocket.Chat UI Example | ||
|
||
<img src="./images/rocketchat.png" alt="Notification Preview" width="90%"> | ||
|
||
# Contribute | ||
1. Fork this repository | ||
2. Pull your repository in local machine | ||
3. Update original repository | ||
4. Checkout "master" branch based "remotes/origin/master" branch | ||
5. Work on "master" branch | ||
6. Push you changes to your repository | ||
7. Create a new Pull Request | ||
|
||
# LICENSE | ||
|
||
[The MIT License (MIT)](https://github.com/RocketChat/Rocket.Chat.GitHub.Action.Notification/blob/master/LICENSE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
describe('TODO - Add a test suite', () => { | ||
it('TODO - Add a test', async () => {}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: 'Rocket.Chat Notification' | ||
description: 'Rocket.Chat Notification for GitHub Actions' | ||
author: 'Rocket.Chat' | ||
inputs: | ||
type: | ||
description: 'job status (success, failure or cancelled)' | ||
required: true | ||
job_name: | ||
description: 'job name of workflow (format: markdown)' | ||
required: true | ||
mention: | ||
description: 'rocket.chat mention' | ||
required: false | ||
mention_if: | ||
description: 'the condition for mention' | ||
required: false | ||
username: | ||
description: 'rocket.chat username' | ||
required: false | ||
icon_emoji: | ||
description: 'rocket.chat icon emoji' | ||
required: false | ||
channel: | ||
description: 'rocket.chat channel' | ||
required: false | ||
url: | ||
description: 'rocket.chat incoming webhook url' | ||
required: false | ||
commit: | ||
description: 'whether include commit data or not (true or false)' | ||
required: false | ||
default: 'false' | ||
token: | ||
description: 'need to get commit data' | ||
required: false | ||
runs: | ||
using: 'node12' | ||
main: 'dist/index.js' | ||
branding: | ||
icon: 'bell' | ||
color: 'green' |
Oops, something went wrong.