From e7f7bd57527c18e5cd574e4553cef1e445664caf Mon Sep 17 00:00:00 2001 From: Stefan Bratanov Date: Mon, 5 Aug 2024 10:43:22 +0100 Subject: [PATCH] Fix condition for running sonar (#18) --- .github/workflows/build.yml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ed6b5fc..0f0e7d1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,9 +24,13 @@ jobs: run: ./gradlew spotlessCheck build env: OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Run Sonar - if: secrets.SONAR_TOKEN != '' - run: ./gradlew jacocoTestReport sonar + - name: Run SonarQube analysis + run: | + if [ -n "$SONAR_TOKEN" ]; then + ./gradlew jacocoTestReport sonar + else + echo "SONAR_TOKEN is not set. Skipping SonarQube analysis." + fi env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}