-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
11 changed files
with
4,587 additions
and
26,997 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,56 +1,74 @@ | ||
name: "Build & Test" | ||
on: # rebuild any PRs and main branch changes | ||
name: graffino-teams-notification-test | ||
run-name: ${{ github.actor }} is performing a Graffino Teams Notification test build | ||
on: | ||
repository_dispatch: | ||
pull_request: | ||
push: | ||
branches: | ||
- master | ||
- 'releases/*' | ||
|
||
- "master" | ||
|
||
jobs: | ||
build: # make sure build/ci work properly | ||
runs-on: ubuntu-latest | ||
build: | ||
runs-on: [self-hosted, graffino] | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest] | ||
node: [18] | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- run: | | ||
npm install | ||
npm run all | ||
test: # make sure the action works on a clean machine without building | ||
runs-on: ubuntu-latest | ||
- name: Checkout | ||
id: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- uses: actions/cache@v3 | ||
with: | ||
path: "**/node_modules" | ||
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} | ||
|
||
- name: Install NPM Packages | ||
if: success() | ||
run: | | ||
yarn install | ||
- name: Build Frontend | ||
if: success() | ||
run: | | ||
yarn run build | ||
test: | ||
runs-on: [self-hosted, graffino] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v4 | ||
- uses: ./ | ||
with: | ||
github-token: ${{ github.token }} | ||
ms-teams-webhook-uri: ${{ secrets.MS_TEAMS_WEBHOOK_URI }} | ||
notification-summary: Deployment Started | ||
notification-color: 17a2b8 | ||
timezone: America/Denver | ||
timezone: Bucharest/Romania | ||
- uses: ./ | ||
with: | ||
github-token: ${{ github.token }} | ||
ms-teams-webhook-uri: ${{ secrets.MS_TEAMS_WEBHOOK_URI }} | ||
notification-summary: Warning! Something Not Quite Right | ||
notification-color: ffc107 | ||
timezone: America/Denver | ||
timezone: Bucharest/Romania | ||
- uses: ./ | ||
with: | ||
github-token: ${{ github.token }} | ||
ms-teams-webhook-uri: ${{ secrets.MS_TEAMS_WEBHOOK_URI }} | ||
notification-summary: OMG!! Something Exploded | ||
notification-color: dc3545 | ||
timezone: America/Denver | ||
timezone: Bucharest/Romania | ||
- uses: ./ | ||
with: | ||
github-token: ${{ github.token }} | ||
ms-teams-webhook-uri: ${{ secrets.MS_TEAMS_WEBHOOK_URI }} | ||
notification-summary: Whew! Everything is right with the world again! | ||
notification-color: 28a745 | ||
timezone: America/Denver | ||
timezone: Bucharest/Romania | ||
- uses: ./ | ||
with: | ||
github-token: ${{ github.token }} | ||
ms-teams-webhook-uri: ${{ secrets.MS_TEAMS_WEBHOOK_URI }} | ||
notification-summary: "Emojify! 🚢 ✅" | ||
notification-color: 28a745 | ||
timezone: America/Denver | ||
timezone: Bucharest/Romania |
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 |
---|---|---|
@@ -1,99 +1,3 @@ | ||
# Dependency directory | ||
node_modules | ||
|
||
# Rest pulled from https://github.com/github/gitignore/blob/master/Node.gitignore | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
|
||
# Diagnostic reports (https://nodejs.org/api/report.html) | ||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
*.lcov | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
jspm_packages/ | ||
|
||
# TypeScript v1 declaration files | ||
typings/ | ||
|
||
# TypeScript cache | ||
*.tsbuildinfo | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
.env | ||
.env.test | ||
|
||
# parcel-bundler cache (https://parceljs.org/) | ||
.cache | ||
|
||
# next.js build output | ||
.next | ||
|
||
# nuxt.js build output | ||
.nuxt | ||
|
||
# vuepress build output | ||
.vuepress/dist | ||
|
||
# Serverless directories | ||
.serverless/ | ||
|
||
# FuseBox cache | ||
.fusebox/ | ||
|
||
# DynamoDB Local files | ||
.dynamodb/ | ||
|
||
# OS metadata | ||
.DS_Store | ||
Thumbs.db | ||
|
||
# Ignore built ts files | ||
__tests__/runner/* | ||
lib/**/* | ||
dist | ||
lib |
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
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 |
---|---|---|
@@ -1,17 +1,17 @@ | ||
<p align="center"> | ||
<a href="https://github.com/jdcargile/ms-teams-notification/actions"><img alt="ms-teams-notification status" src="https://github.com/jdcargile/ms-teams-notification/workflows/Build%20&%20Test/badge.svg"></a> | ||
</p> | ||
# Microsoft Teams Notification | ||
|
||
![Build Status](https://github.com/Graffino/Graffino-Teams-Notification/workflows/graffino-teams-notification-test/badge.svg) | ||
|
||
# Microsoft Teams Notification | ||
A GitHub Action that sends customizable notifications to a dedicated Microsoft Teams channel. | ||
|
||
## Usage | ||
|
||
1. Add `MS_TEAMS_WEBHOOK_URI` on your repository's configs on Settings > Secrets. It is the [Webhook URI](https://docs.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/add-incoming-webhook) of the dedicated Microsoft Teams channel for notification. | ||
|
||
2) Add a new `step` on your workflow code below `actions/checkout@v2`: | ||
2. Add a new `step` on your workflow code below `actions/checkout@v2`: | ||
|
||
```yaml | ||
name: MS Teams Notification | ||
name: Graffino Teams Notification | ||
|
||
on: [push, pull_request] | ||
|
||
|
@@ -20,36 +20,35 @@ jobs: | |
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
# this is the new step using the ms-teams-notification action | ||
- uses: actions/checkout@v4 | ||
- name: Notify dedicated teams channel | ||
uses: jdcargile/[email protected] | ||
uses: Graffino/Graffino-Teams-Notification@v2 | ||
with: | ||
github-token: ${{ github.token }} # this will use the runner's token. | ||
github-token: ${{ github.token }} | ||
ms-teams-webhook-uri: ${{ secrets.MS_TEAMS_WEBHOOK_URI }} | ||
notification-summary: Your custom notification message | ||
notification-color: 17a2b8 | ||
timezone: America/Denver | ||
timezone: Bucharest/Romania | ||
``` | ||
3. Make it your own with the following configurations. | ||
- `github-token` - (required), set to the following: | ||
- `${{ github.token }}` | ||
- `webhook-uri` - (required), setup a new secret to store your Microsoft Teams Webhook URI (ex. `MS_TEAMS_WEBHOOK_URI`). Learn more about setting up [GitHub Secrets](https://help.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets) or [Microsoft Teams Incoming Webhook](https://docs.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/add-incoming-webhook). | ||
- `notification-summary` (required), Your custom notification message (ex. Deployment Started or Build Successful) | ||
- `notification-color` (optional), Custom color to help distinguish type of notification. Can be any [HEX color](https://html-color.codes/). (ex. **007bff** or **17a2b8** for info, **28a745** success, **ffc107** warning, **dc3545** error, etc.) | ||
- `notification-color` (optional), Custom color to help distinguish type of notification. Can be any [HEX color](https://html-color.codes/). (ex. **007bff** or **17a2b8** for info, **28a745** success, **ffc107** warning, **dc3545** error, etc.) | ||
- `timezone` - (optional, defaults to `UTC`), a [valid database timezone name](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones), (ex. Australia/Sydney or America/Denver, etc.) | ||
- `timeout` - (optional, defaults to 5s), this prevents action from getting stuck when Teams WebHooks misbehave. | ||
- `job` - (automatically pulled from GitHub Actions), contains the stringified object for the current job, used to get the job status and display notification accordingly. | ||
|
||
## Examples | ||
|
||
As you can see below, the `notification-summary` and `notification-color` are being used to customize the appearance of the message. Use bright vibrant colors to notify your Microsoft Teams channel of warnings or errors in your GitHub Actions workflow. | ||
|
||
<p align="center"> | ||
<img src="notification-color-screenshots.png"> | ||
</p> | ||
![Notification screenshot](notification-color-screenshots.png) | ||
|
||
### Emojis | ||
Emoji support isn't great for incoming webhooks on Microsoft Teams yet. You can hack your way through it using HEX codes. For example, in `notification-summary` I used `Emojify! 🚢 ✅` for the following screenshot. HEX codes for emojis [here](https://apps.timwhitlock.info/emoji/tables/unicode). | ||
|
||
<p align="center"> | ||
<img src="notification-emoji-screenshot.png"> | ||
</p> | ||
Emoji support isn't great for incoming webhooks on Microsoft Teams yet. You can hack your way through it using HEX codes. For example, in `notification-summary` I used `Emojify! 🚢 ✅` for the following screenshot. HEX codes for emojis [here](https://apps.timwhitlock.info/emoji/tables/unicode). | ||
|
||
![Notification screenshot](notification-emoji-screenshot.png) |
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
Oops, something went wrong.