Git Action Teams 알람 설정하기

2022. 7. 27. 17:39git

사용 이유

Git Action이 진행 될 때  CI/CD가 성공, 실패 시 Teams에 개발자 또는 관련된 사람들에게 알람을 보내준다.

 

순서

  1. Teams 연결 링크 만들기
  2. Git Action Secret에 연결링크 저장
  3. Teams 연결 Marketplace 복사
  4. yml파일에 Marketplace 코드를 넣고 Git Action Secret를 넣어준다.

 

 

1. Teams 연결 링크 만들기

Teams 연결 링크 만들기 : https://crispypotato.tistory.com/233

 

2. Git Action Secret에 연결링크 저장

Teams에 연결하는 링크를 저장 할 Secret 생성
링크 저장

 

 

3. Teams 연결 Marketplace 복사

해당 링크에서 최신 버전을 코드를 복사 한다.

https://github.com/marketplace/actions/microsoft-teams-deploy-card

 

Microsoft Teams Deploy Card - GitHub Marketplace

Notify your Teams channel with a beautiful, comprehensive deployment card

github.com

 

 

4.yml파일에 Marketplace 코드를 넣고 Git Action Secret를 넣어준다.

 

*Git Action Secret 은 ex) ${{secrets.000}} 형식으로 가져온다.

 webhook-uri: ${{ secrets.TEAMS }}

      - name: CI Fail
        uses: toko-bifrost/ms-teams-deploy-card@3.1.2
        with:
          github-token: ${{ github.token }}
          webhook-uri: ${{ secrets.TEAMS }}
          card-layout-exit: complete
        if: failure()

 

ex)

on:
  push:
    branches:
      - test
env:
  CRYPTO: ${{ secrets.CRYPTO }}
  JWT: ${{ secrets.JWT }}
  PORT: ${{ secrets.PORT }}

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout code
        uses: actions/checkout@v2

      - name: Set up Node.js version
        uses: actions/setup-node@v1
        with:
          node-version: '16.x'

      - name: Download Static File
        run: |
          mkdir data
          curl -o ${{github.workspace}}/data/coco.json https://test.net/back-data/coco.json
          curl -o ${{github.workspace}}/data/daily.json https://test.net/back-data/daily.json

      - name: Install packages
        run: npm i

      - name: Run Unit Test
        run: npm run test

      - name: CI Fail
        uses: toko-bifrost/ms-teams-deploy-card@3.1.2
        with:
          github-token: ${{ github.token }}
          webhook-uri: ${{ secrets.TEAMS }}
          card-layout-exit: complete
        if: failure()
728x90
반응형