A Github action that posts messages via Microsoft Teams when a workflow job fails.
- Integration with Microsoft Teams via Incoming Webhook
- Supports workflows with both single and multiple jobs
- Notification on configurable workflow states:
failure
: current workflow run has failed or was cancelledfixed
: first successful workflow run after a failure or cancellationsuccess
: current workflow run has succeeded
- Colourful message card design for notifications
- Linux
- macOS
steps:
- name: Notify Teams
if: always() && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop')
uses: ecmwf-actions/notify-teams@v1
with:
incoming_webhook: ${{ secrets.MS_TEAMS_INCOMING_WEBHOOK }}
jobs:
qa:
...
ci:
...
deploy:
...
notify:
name: notify
runs-on: ubuntu-20.04
needs:
- ci
- qa
- deploy
if: always() && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop')
steps:
- name: Notify Teams
uses: ecmwf-actions/notify-teams@v1
with:
incoming_webhook: ${{ secrets.MS_TEAMS_INCOMING_WEBHOOK }}
needs_context: ${{ toJSON(needs) }}
steps:
- name: Notify Teams
if: failure() && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop')
uses: ecmwf-actions/notify-teams@v1
with:
incoming_webhook: ${{ secrets.MS_TEAMS_INCOMING_WEBHOOK }}
notify_on: |
failure
Required Public URL of the Microsoft Teams incoming webhook. To get the value, make sure that channel in Teams has the appropriate connector set up. Recommended way to define this value is via a secret, e.g. ${{ secrets.MS_TEAMS_INCOMING_WEBHOOK }}
.
Required The list of states to notify on. Allowed values are failure
, fixed
and success
.
Multiline Support: yes
Default:
failure
fixed
Required The ID of the current job.
Default: ${{ github.job }}
Required The current job context, must be encoded as JSON.
Default: ${{ toJSON(job) }}
The list of dependent job contexts, must be encoded as JSON. To pass the current needs
context, use ${{ toJSON(needs) }}
.
Required The currently checked out source repository name. Repository names should follow the standard Github owner/name
format.
Default: ${{ github.repository }}
Required The repository branch name to check the CI workflow status for.
Default: ${{ github.ref }}
Required The current repository commit SHA.
Default: ${{ github.sha }}
Required The name of the current workflow.
Default: ${{ github.workflow }}
Required The ID or filename of the CI workflow to check.
Default: ci.yml
Required The ID of the current workflow run.
Default: ${{ github.run_id }}
Required Github access token, with actions:read
scope.
Default: ${{ github.token }}
List of considered jobs and their stats.
Example: [{"name": "ci", "value": "success"}]
Status of the previous workflow run.
Example: success
Conclusion of the previous workflow run.
Example: unknown
Whether or not the message has been sent.
Example: true
npm install
A courtesy Git pre-commit hook is provided, that conveniently runs a lint check, builds the action and stages any changes. To skip the hook, simply add --no-verify
switch to the Git commit command.
This action transpiles its code into a self-contained script, pulling in all of its dependencies. This will happen automatically by the installed pre-commit hook, but in case you do not have it install just make sure to run the build command manually after any changes and stage dist/
directory.
npm run build
npm run lint
npm test
This software is licensed under the terms of the Apache License Version 2.0 which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
In applying this licence, ECMWF does not waive the privileges and immunities granted to it by virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.