There are various options for notifying Microsoft Teams when using GitHub Actions.
Name | Automatic messages on pipeline events | Custom messages | Remarks |
---|---|---|---|
Action Microsoft Teams Deploy Card | Yes | No | Supports adding custom facts and actions |
Action Microsoft Teams Notification | No | Yes | |
Action Notify Microsoft Teams | Yes | No | |
Action Microsoft Teams Actions | No | Yes | Custom cards can be added |
GitHub App for Microsoft Teams | Yes, subscribable by users | No | Microsoft Teams user has full customization options, when to be notified; conversations for pull-requests can be done in MS Teams |
GitHub App for Microsoft Teams is nice for handling the whole GitHub experience and workflow in Microsoft Teams.
For build notifications, we are prefering a combination of Microsoft Teams Actions and Microsoft Teams Deploy Card.
In Microsoft Teams
- In Microsoft Teams, select the channel to be notified and then Connectors
- Search for Incoming Webhook and click Add
- After that, configure the connector by giving it a unique name.
- Copy the Webhook URI.
- Click on Done
In GitHub Actions
Either in your organization or repository add a new secret named MICROSOFT_TEAMS_WEBHOOK_URI
and paste in the value of the copied Webhook URI:
In your GitHub Actions workflow.yml
you can use the following cominbation:
name: Microsoft Teams notification
on:
push:
branches:
- main
- develop
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# notify on each build event like starting and finishing a build
- uses: toko-bifrost/ms-teams-deploy-card@master
if: always()
with:
github-token: ${{ github.token }}
webhook-uri: ${{ secrets.MICROSOFT_TEAMS_WEBHOOK_URI }}
# notify Microsoft Teams channel with a custom message
- uses: aliencube/microsoft-teams-actions@v0.8.0
with:
webhook_uri: ${{ secrets.MICROSOFT_TEAMS_WEBHOOK_URI }}
title: This is a custom message
summary: This is a message summary
After running this GitHub Action workflow, your Microsoft Teams channel will be notified: