Git Product home page Git Product logo

ms-teams-notification's Introduction

ms-teams-notification status

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 of the dedicated Microsoft Teams channel for notification.
  1. Add a new step on your workflow code below actions/checkout@v4:
name: MS Teams Notification

on: [push, pull_request]

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4
      # this is the new step using the ms-teams-notification action
      - name: Notify dedicated teams channel
        uses: jdcargile/[email protected]
        with:
          github-token: ${{ github.token }} # this will use the runner's token.
          ms-teams-webhook-uri: ${{ secrets.MS_TEAMS_WEBHOOK_URI }}
          notification-summary: Your custom notification message 
          notification-color: 17a2b8
          timezone: America/Denver
          verbose-logging: true
  1. Make it your own with the following configurations.
    • github-token - (required), set to the following:
      • ${{ github.token }}
    • ms-teams-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 or Microsoft Teams 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. (ex. 007bff or 17a2b8 for info, 28a745 success, ffc107 warning, dc3545 error, etc.)
    • timezone - (optional, defaults to UTC), a valid database timezone name, (ex. Australia/Sydney or America/Denver, etc.)
    • verbose-logging - (optional, defaults to false), Emits additional logging showing the sent message card and response from the webhook.

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.

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! &#x1F6A2โ€‹โ€‹ ✅ for the following screenshot. HEX codes for emojis here.

ms-teams-notification's People

Contributors

canberkakduygu avatar dependabot[bot] avatar dmacusb2 avatar dnepusb2 avatar falnyr avatar jdcargile avatar vbyrd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

ms-teams-notification's Issues

Feature Request

Provide the ability to customize or omit message buttons such as "View Workflow Run" or "View Commit Changes".

notification color doesn't work

Hi,
do you have any idea why notification color doesn't work? I guess even default one 0b93ff is not displayed.
image

steps:
  - uses: actions/checkout@v4
  - name: Notify dedicated teams channel
    uses: jdcargile/[email protected]
    with:
      github-token: ${{ github.token }}
      ms-teams-webhook-uri: ${{ secrets.MS_TEAMS_WEBHOOK_URI }}
      notification-summary: Test notification message 
      notification-color: ffc107
      verbose-logging: true

Make Repo BaseURL configurable

I am using this action in our workflow in the repo hosted at github.com and it works well, thanks for that.

Now I am trying to use a fork of it on GitHub enterprise and it does not work because the repo base URL is hard-coded
https://github.com/jdcargile/ms-teams-notification/blob/master/src/main.ts#L39

can I request to make this part configurable so we can use https://github.com or some GitHub enterprise base URL instead e.g https://github.somebigenterprise.com/some_repo

I am new to collaboration but I am happy to submit a PR if that is what helps moving us forward, thanks

Verbose Logging Control

Problem: This action emits a large amount of logging by default. When used in a composite action with other steps, this action will eclipse the logs of other steps.

Example:
image

Solution: I created a PR to add Verbose Logging control via an optional "verbose-logging" input:
#34

I have not tested these changes.

Passing multiple webhook URI

The action is not working when we pass multiple webhook URI's as input
Any suggestions on how to pass multiple webhooks to a called Yaml from a caller Yaml without using matrix.

TypeError: Cannot read property 'avatar_url' or null

Hello,

I can't reproduce this all the time, but maybe every other time I get the following error:

TypeError: Cannot read property 'avatar_url' of null at Object.createMessageCard (C:\Users\rdbot\Desktop\action-runners\pdp_utils\_work\_actions\jdcargile\ms-teams-notification\v1.2\dist\index.js:2341:39) at C:\Users\rdbot\Desktop\action-runners\pdp_utils\_work\_actions\jdcargile\ms-teams-notification\v1.2\dist\index.js:2959:54 at Generator.next (<anonymous>) at fulfilled (C:\Users\rdbot\Desktop\action-runners\pdp_utils\_work\_actions\jdcargile\ms-teams-notification\v1.2\dist\index.js:2906:58) at processTicksAndRejections (internal/process/task_queues.js:93:5) ##[error]Cannot read property 'avatar_url' of null

error in master branch

    uses: jdcargile/ms-teams-notification@master
    with:
      github-token: ${{ github.token }} # this will use the runner's token.
      ms-teams-webhook-uri: ${{ secrets.MS_TEAMS_WEBHOOK_URI }}
      notification-summary: IN_PROGRESS
      notification-color: 17a2b8

this was supposeto fix a bug in avatar but now a new bug

TypeError: Cannot read property 'login' of null
at Object.createMessageCard (/runner/_work/_actions/jdcargile/ms-teams-notification/master/dist/index.js:2461:85)
at /runner/_work/_actions/jdcargile/ms-teams-notification/master/dist/index.js:3090:54
at Generator.next ()
at fulfilled (/runner/_work/_actions/jdcargile/ms-teams-notification/master/dist/index.js:3044:58)
at processTicksAndRejections (internal/process/task_queues.js:97:5)

tsc skipped in build process

Hi, I don't have much experience with ts but seems like this commit e38bccc
didn't fix Error: error:0308010C:digital envelope routines::unsupported
"build": "set NODE_OPTIONS=--openssl-legacy-provider tsc", makes that tsc command is not run at all
so changes made to main.ts are not reflected in index.js
I would suggest adding && between commands
also I noticed that export should be used instead of set command

Node.js 12 actions are deprecated

Node.js 12 actions are deprecated. Please update the following actions to use Node.js 16: jdcargile/[email protected]. For more information see: https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/.

Node 12 has been out of support since April 2022, as a result we have started the deprecation process of Node 12 for GitHub Actions. We plan to migrate all actions to run on Node16 by Summer 2023. We will monitor the progress of the migration and listen to the community for how things are going before we define a final date.
To raise awareness of the upcoming change, we are adding a warning into workflows which contain Actions running on Node 12. This will come into effect starting on September 27th.

Add URL in notification summary?

Hello,

Is it possible to add a URL to the notification summary? I tried using the markup syntax but it gets printed as it is. Any idea?
Thanks

Ability to set up the author of the notification

Hey all,
if my current understanding is correct, right now the ms-teams-notification, take the author from the notification from the last commit message.

Are an existing way to extend that to use the own author name or ${{ github.actor }} for GHA workflow execution that'll help a lot.?

Cannot read property 'avatar_url' of null

Getting this error and I'm unsure why.

TypeError: Cannot read property 'avatar_url' of null
at Object.createMessageCard (/home/runner/work/_actions/jdcargile/ms-teams-notification/v1.3/dist/index.js:2446:16)
at /home/runner/work/_actions/jdcargile/ms-teams-notification/v1.3/dist/index.js:3088:54
at Generator.next ()
at fulfilled (/home/runner/work/_actions/jdcargile/ms-teams-notification/v1.3/dist/index.js:3042:58)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
Error: Cannot read property 'avatar_url' of null

The ms-teams-notification step is executed by the workflow successfully, but MS Teams channel don't display any notifications

Hi,

I have added the following code snippet to my yml file and the workflow executed successfully without any error. However, I don't get the notification on the MS Team Channel. Everything looks good with webhook and I used a github token which has been already in use in the same workflow. I am not sure what needs to be fixed, please help.
steps:
- name: Notify dedicated teams channel
uses: jdcargile/[email protected]
with:
github-token: ${{ github.token }} # this will use the runner's token.
ms-teams-webhook-uri: ${{ secrets.MSTEAMS_WEBHOOK }}
notification-summary: Pipeline starts
notification-color: 17a2b8
timezone: America/Denver

Thanks
Ramya

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.