From 9d58cbac871ecdd021d61eecd931aaf31195dcd2 Mon Sep 17 00:00:00 2001 From: Sean Sylver Date: Tue, 1 Oct 2024 11:30:42 -0700 Subject: [PATCH 1/2] Update sonar-project.properties --- .github/workflows/sonarscan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sonarscan.yml b/.github/workflows/sonarscan.yml index 67282316d..c8e32e16d 100644 --- a/.github/workflows/sonarscan.yml +++ b/.github/workflows/sonarscan.yml @@ -40,7 +40,7 @@ jobs: - name: Set up Node.js uses: actions/setup-node@v4 with: - node-version: '18' + node-version: '18' cache: 'yarn' cache-dependency-path: './client/wfprev-war/src/main/angular/yarn.lock' From 83b41e5e669876dc741e165c1aa036d591d1829a Mon Sep 17 00:00:00 2001 From: Sean Sylver Date: Tue, 1 Oct 2024 14:47:46 -0700 Subject: [PATCH 2/2] Notify slack channel on failure --- .github/workflows/sonarscan.yml | 14 ++++++++++++++ sonar-project.properties | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/sonarscan.yml b/.github/workflows/sonarscan.yml index c8e32e16d..c2d23655d 100644 --- a/.github/workflows/sonarscan.yml +++ b/.github/workflows/sonarscan.yml @@ -15,6 +15,20 @@ on: types: [opened, synchronize, reopened] jobs: + on-failure: + runs-on: ubuntu-latest + if: github.event.workflow_run.conclusion == 'failure' || github.event.workflow_run.conclusion == 'timed_out' + steps: + - uses: ravsamhq/notify-slack-action@2.5.0 + with: + status: ${{ github.event.workflow_run.conclusion }} + notification_title: " ${{github.event.workflow_run.name}} - ${{github.event.workflow_run.conclusion}} on ${{github.event.workflow_run.head_branch}} - <${{github.server_url}}/${{github.repository}}/actions/runs/${{github.event.workflow_run.id}}|View Failure>" + message_format: ":fire: *${{github.event.workflow_run.name}}* ${{github.event.workflow_run.conclusion}} in <${{github.server_url}}/${{github.repository}}/${{github.event.workflow_run.head_branch}}|${{github.repository}}>" + footer: "Linked Repo <${{github.server_url}}/${{github.repository}}|${{github.repository}}> | <${{github.server_url}}/${{github.repository}}/actions/runs/${{github.event.workflow_run.id}}|View Failure>" + mention_groups: "C06LDNP3Q7M,!channel" + mention_groups_when: "failure" + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} sonarcloud: name: SonarCloud Scan runs-on: ubuntu-latest diff --git a/sonar-project.properties b/sonar-project.properties index 5ed0c0528..4393e931c 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -3,7 +3,7 @@ sonar.projectKey=bcgov_nr-bcws-wfprev sonar.projectName=wfprev-parent sonar.host.url=https://sonarcloud.io sonar.sources=client,server/wfprev-api/target/classes -sonar.exclusions=server/wfprev-api/src/main/java/ca/bc/gov/nrs/wfprev/data/**,**/*ServletInitializer.java,**/*Exception.java,**/*.html,**/*.scss,**/*.main.ts,**/*.environment*.ts,**/*.app-routing.module.ts +sonar.exclusions=server/wfprev-api/src/main/java/ca/bc/gov/nrs/wfprev/data/**,**/*ServletInitializer.java,**/*Exception.java,**/*.html,**/*.scss,**/main.ts,**/environment*.ts,**/app-routing.module.ts sonar.coverage.jacoco.xmlReportPaths=server/wfprev-api/target/site/jacoco/jacoco.xml sonar.javascript.lcov.reportPaths=client/wfprev-war/src/main/angular/coverage/wfprev/lcov.info sonar.sources=server/wfprev-api/src/main/java,client/wfprev-war/src/main/angular/src