From 30e92fdbe38428840e44f7208fc2353cb15aa940 Mon Sep 17 00:00:00 2001 From: Axel Vankrunkelsven Date: Fri, 27 Mar 2026 15:03:38 +0100 Subject: [PATCH] CLEARFACTS-12646: Add project version to SonarQube scan --- .github/workflows/sonarqube.yml | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml index 21aad880000..ab855530f67 100644 --- a/.github/workflows/sonarqube.yml +++ b/.github/workflows/sonarqube.yml @@ -10,11 +10,19 @@ jobs: sonarqube: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: SonarQube Scan - uses: SonarSource/sonarqube-scan-action@v5.1.0 - env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} + - uses: actions/checkout@v4 + with: + # Disabling shallow clones is recommended for improving the relevancy of reporting + fetch-depth: 0 + - name: Resolve environment variables + if: github.ref == 'refs/heads/master' + shell: bash + run: echo "BUILD_NUMBER=v${{ github.run_number }}" >> $GITHUB_ENV + - name: SonarQube Scan + uses: SonarSource/sonarqube-scan-action@v5.1.0 # Ex: v4.1.0, See the latest version at https://github.com/marketplace/actions/official-sonarqube-scan + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} + with: + args: > + ${{ github.ref == 'refs/heads/master' && format('-Dsonar.projectVersion={0}', env.BUILD_NUMBER) || '' }}