From 2aa85a5b7d8f6d455787cd480dcfa7df906fd0e3 Mon Sep 17 00:00:00 2001 From: Nazaret Garcia Date: Mon, 11 Nov 2024 19:40:52 -0300 Subject: [PATCH] Updating conditionals --- .github/workflows/build_and_test.yml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index f7f7ede65e..19e3fe6afd 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -108,12 +108,16 @@ jobs: GH_REF: ${{ github.ref }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} run: | - if [ "$GH_EVENT" = "pull_request" ]; then # If this is a PR, then add pointers to it - ./gradlew -Dorg.gradle.jvmargs=-Xmx5g sonar --no-daemon -x build -x test \ - -Dsonar.pullrequest.base="$GH_PR_BASE_REF" \ - -Dsonar.pullrequest.branch="$GH_PR_HEAD_REF" \ - -Dsonar.pullrequest.key="$GH_PR_NUMBER" \ - -Dsonar.token="$SONAR_TOKEN" + if [ "$GH_EVENT" = "pull_request" ]; then + if [ "$SONAR_TOKEN" != "" ]; then + ./gradlew -Dorg.gradle.jvmargs=-Xmx5g sonar --no-daemon -x build -x test \ + -Dsonar.pullrequest.base="$GH_PR_BASE_REF" \ + -Dsonar.pullrequest.branch="$GH_PR_HEAD_REF" \ + -Dsonar.pullrequest.key="$GH_PR_NUMBER" \ + -Dsonar.token="$SONAR_TOKEN" + else + echo "Skipping SonarQube analysis." + fi else ./gradlew -Dorg.gradle.jvmargs=-Xmx5g sonar --no-daemon -x build -x test \ -Dsonar.branch.name="$GH_REF" \