|
| 1 | +# Rocket.Chat.GitHub.Action.Notification |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | +This is Rocket.Chat Notification for GitHub Actions.<br> |
| 8 | +Generated from [actions/javascript-template](https://github.com/actions/javascript-template). |
| 9 | + |
| 10 | +# Feature |
| 11 | +- Notify the result of GitHub Actions |
| 12 | +- Support three job status (reference: [job-context](https://help.github.com/en/articles/contexts-and-expression-syntax-for-github-actions#job-context)) |
| 13 | + - success |
| 14 | + - failure |
| 15 | + - cancelled |
| 16 | +- Mention |
| 17 | + - Notify message to channel members efficiently |
| 18 | + - You can specify the condition to mention |
| 19 | + |
| 20 | +# How to use |
| 21 | +First of all, you need to set GitHub secrets for ROCKETCHAT_WEBHOOK that is Incoming Webhook URL.<br> |
| 22 | +You can customize the following parameters: |
| 23 | + |
| 24 | +|with parameter|required/optional|default|description| |
| 25 | +|:--:|:--:|:--|:--| |
| 26 | +|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 }}| |
| 27 | +|job_name|required|N/A|Means rocket.chat notification title| |
| 28 | +|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| |
| 29 | +|mention|optional|N/A|Rocket.Chat message mention| |
| 30 | +|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`| |
| 31 | +|icon_emoji|optional|Use Rocket.Chat Incoming Webhook configuration|Rocket.Chat icon| |
| 32 | +|username|optional|Use Rocket.Chat Incoming Webhook configuration|Rocket.Chat username| |
| 33 | +|channel|optional|Use Rocket.Chat Incoming Webhook configuration|Rocket.Chat channel name| |
| 34 | +|commit|optional|false|If true, Rocket.Chat notification includes the latest commit message and author.| |
| 35 | +|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.| |
| 36 | + |
| 37 | +Please refer `action.yml` for more details. |
| 38 | + |
| 39 | +## Examples |
| 40 | + |
| 41 | +```..github/workflows/example1.yml |
| 42 | +- name: Rocket.Chat Notification |
| 43 | + uses: RocketChat/Rocket.Chat.GitHub.Action.Notification@master |
| 44 | + if: always() |
| 45 | + with: |
| 46 | + type: ${{ job.status }} |
| 47 | + job_name: '*Lint Check*' |
| 48 | + mention: 'here' |
| 49 | + mention_if: 'failure' |
| 50 | + channel: '#random' |
| 51 | + url: ${{ secrets.ROCKETCHAT_WEBHOOK }} |
| 52 | +``` |
| 53 | + |
| 54 | +↓ Including the latest commit data |
| 55 | + |
| 56 | +```..github/workflows/example2.yml |
| 57 | +- name: Rocket.Chat Notification |
| 58 | + uses: RocketChat/Rocket.Chat.GitHub.Action.Notification@master |
| 59 | + if: always() |
| 60 | + with: |
| 61 | + type: ${{ job.status }} |
| 62 | + job_name: '*Lint Check*' |
| 63 | + mention: 'here' |
| 64 | + mention_if: 'failure' |
| 65 | + channel: '#random' |
| 66 | + url: ${{ secrets.ROCKETCHAT_WEBHOOK }} |
| 67 | + commit: true |
| 68 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 69 | +``` |
| 70 | + |
| 71 | +# Rocket.Chat UI Example |
| 72 | + |
| 73 | +<img src="./images/rocketchat.png" alt="Notification Preview" width="90%"> |
| 74 | + |
| 75 | +# Contribute |
| 76 | +1. Fork this repository |
| 77 | +2. Pull your repository in local machine |
| 78 | +3. Update original repository |
| 79 | +4. Checkout "master" branch based "remotes/origin/master" branch |
| 80 | +5. Work on "master" branch |
| 81 | +6. Push you changes to your repository |
| 82 | +7. Create a new Pull Request |
| 83 | + |
| 84 | +# LICENSE |
| 85 | + |
| 86 | +[The MIT License (MIT)](https://github.com/RocketChat/Rocket.Chat.GitHub.Action.Notification/blob/master/LICENSE) |
0 commit comments