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

  1. In Microsoft Teams, select the channel to be notified and then Connectors
    Manage channel
  2. Search for Incoming Webhook and click Add
    Incoming Webhook connector
  3. After that, configure the connector by giving it a unique name.
  4. Copy the Webhook URI.
  5. 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:

Adding the Webhook URL as secret

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:

Notifications in Microsoft Teams send by GitHub Actions

Notes

  • Additional sections and actions for a custom notification can be added by using the sections and actions JSON key. See #1 and #2