From 99f269ecf3e677f50e50c922fdf6776a50809d05 Mon Sep 17 00:00:00 2001 From: Edwin Sany Date: Tue, 16 Apr 2024 10:13:33 +0530 Subject: [PATCH] fix: update sonarqube workflow to reduce runner minutes --- .github/workflows/sonar.yml | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/.github/workflows/sonar.yml b/.github/workflows/sonar.yml index 1a7a478..d1cd670 100644 --- a/.github/workflows/sonar.yml +++ b/.github/workflows/sonar.yml @@ -1,21 +1,20 @@ name: Sonarqube_CI on: + pull_request: + types: + - labeled + push: branches: - master - main - - develop - - pull_request: - types: [opened, synchronize, reopened] - branches: - - '**' - workflow_dispatch: + - release-* jobs: build: name: Sonarqube_CI + if: ${{ github.event.label.name == 'sonar_check' || github.event_name == 'push' }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -26,11 +25,11 @@ jobs: uses: sonarsource/sonarqube-scan-action@master env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} + SONAR_HOST_URL: 'https://sonarqube.taotesting.info/sonarqube/' # Job will fail when the Quality Gate is red - name: Sonarqube quality gate check - id: sonarqube-quality-gate-check + id: sonarqube-quality-gate-check uses: sonarsource/sonarqube-quality-gate-action@master timeout-minutes: 5 env: @@ -38,4 +37,4 @@ jobs: - name: "Example show SonarQube Quality Gate Status value" - run: echo "The Quality Gate status is ${{ steps.sonarqube-quality-gate-check.outputs.quality-gate-status }}" + run: echo "The Quality Gate status is ${{ steps.sonarqube-quality-gate-check.outputs.quality-gate-status }}" \ No newline at end of file