diff --git a/.github/workflows/validate.yaml b/.github/workflows/validate.yaml index 625eaf54..f1b99b2d 100644 --- a/.github/workflows/validate.yaml +++ b/.github/workflows/validate.yaml @@ -9,6 +9,8 @@ jobs: validate: name: 'Validate' runs-on: ubuntu-24.04 + env: + RUN_SONARQUBE_ANALYSIS: ${{ secrets.SONAR_TOKEN != '' }} steps: - uses: actions/checkout@v2 with: @@ -27,10 +29,10 @@ jobs: - name: 'Set CHROME_BIN environment variable' run: 'echo "CHROME_BIN=${{ steps.setup-chrome.outputs.chrome-path }}" >> $env:GITHUB_ENV' - name: Install SonarQube Cloud scanner + if: ${{ env.RUN_SONARQUBE_ANALYSIS == 'true' }} run: 'dotnet tool install --global dotnet-sonarscanner' - name: Begin SonarQube Cloud analysis - env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + if: ${{ env.RUN_SONARQUBE_ANALYSIS == 'true' }} run: 'dotnet-sonarscanner begin /k:"turnierplan-NET_turnierplan.NET" /o:"turnierplan-net" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.vscoveragexml.reportsPaths="coverage.xml" /d:sonar.javascript.lcov.reportPaths="**/lcov.info" /d:sonar.coverage.exclusions="**/*.spec.ts" /d:sonar.exclusions="Turnierplan.Dal/Migrations/*"' working-directory: './src' - name: 'Restore .NET solution' @@ -57,7 +59,6 @@ jobs: run: 'npm run test:ci' working-directory: './src/Turnierplan.App/Client/' - name: End SonarQube Cloud analysis - env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + if: ${{ env.RUN_SONARQUBE_ANALYSIS == 'true' }} run: 'dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"' working-directory: './src'