diff --git a/.github/workflows/api-dotnetcore.yml b/.github/workflows/api-dotnetcore.yml index 721c1208a7..3289b4edc4 100644 --- a/.github/workflows/api-dotnetcore.yml +++ b/.github/workflows/api-dotnetcore.yml @@ -12,6 +12,7 @@ jobs: env: working-directory: ./backend GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GIT_BRANCH: "${{github.ref}}" steps: - uses: actions/checkout@v2 @@ -24,7 +25,7 @@ jobs: - name: Setup .NET 6 uses: actions/setup-dotnet@v1 with: - dotnet-version: '6.0.x' + dotnet-version: "6.0.x" - name: Install dependencies run: dotnet restore @@ -115,6 +116,19 @@ jobs: # The SonarQube server URL. For SonarCloud, skip this setting. sonarHostname: ${{secrets.SONAR_URL}} + # Send notifications only if MS_TEAMS_NOTIFY_URL secret has been set + - name: Failure notification to Teams Channel + env: + MS_TEAMS_NOTIFY_URL: ${{ secrets.MS_TEAMS_NOTIFY_URL }} + if: env.MS_TEAMS_NOTIFY_URL != '' && failure() && steps.scan.outcome == 'failure' && github.event_name == 'push' + uses: jdcargile/ms-teams-notification@v1.3 + with: + github-token: ${{ github.token }} + ms-teams-webhook-uri: ${{ env.MS_TEAMS_NOTIFY_URL }} + notification-summary: PIMS Sonar Scan FAILED in ${{env.GIT_BRANCH}} environment + notification-color: ff0000 + timezone: America/Los_Angeles + - name: Find Comment if: failure() && steps.scan.outcome == 'failure' && github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository uses: peter-evans/find-comment@v1 diff --git a/.github/workflows/app-react.yml b/.github/workflows/app-react.yml index 1e26d9f8d7..76a326f985 100644 --- a/.github/workflows/app-react.yml +++ b/.github/workflows/app-react.yml @@ -12,6 +12,7 @@ jobs: env: CI: true working-directory: ./frontend + GIT_BRANCH: "${{github.ref}}" strategy: matrix: @@ -73,6 +74,19 @@ jobs: -Dsonar.projectName=${{env.PROJECT_NAME}} -Dsonar.qualitygate.wait=true + # Send notifications only if MS_TEAMS_NOTIFY_URL secret has been set + - name: Failure notification to Teams Channel + env: + MS_TEAMS_NOTIFY_URL: ${{ secrets.MS_TEAMS_NOTIFY_URL }} + if: env.MS_TEAMS_NOTIFY_URL != '' && failure() && steps.scan.outcome == 'failure' && github.event_name == 'push' + uses: jdcargile/ms-teams-notification@v1.3 + with: + github-token: ${{ github.token }} + ms-teams-webhook-uri: ${{ env.MS_TEAMS_NOTIFY_URL }} + notification-summary: PIMS Sonar Scan FAILED in ${{env.GIT_BRANCH}} environment + notification-color: ff0000 + timezone: America/Los_Angeles + - name: Find Comment if: failure() && steps.scan.outcome == 'failure' && github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository uses: peter-evans/find-comment@v1