diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 39520fd96ce..4e2b41cec49 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -182,10 +182,12 @@ jobs: SOURCE_BRANCH: ${{ github.event.pull_request.head.ref }} TARGET_BRANCH: ${{ github.event.pull_request.base.ref }} run: | + pip install setuptools_scm echo "PR_NUMBER=${PR_NUMBER}" >> sonar_env echo "SOURCE_REPOSITORY=${SOURCE_REPOSITORY}" >> sonar_env echo "SOURCE_BRANCH=${SOURCE_BRANCH}" >> sonar_env echo "TARGET_BRANCH=${TARGET_BRANCH}" >> sonar_env + echo "PROJECT_VERSION=$(python -m setuptools_scm)" >> sonar_env cat sonar_env diff --git a/.github/workflows/sonar.yml b/.github/workflows/sonar.yml index dd306268f95..b503bee74f2 100644 --- a/.github/workflows/sonar.yml +++ b/.github/workflows/sonar.yml @@ -84,6 +84,9 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_CTAO }} SONAR_HOST_URL: https://sonar-ctao.zeuthen.desy.de + with: + args: > + -Dsonar.projectVersion=${{ env.PROJECT_VERSION }} - name: Sonarqube Scan PR if: github.event.workflow_run.event == 'pull_request' @@ -94,6 +97,7 @@ jobs: SONAR_HOST_URL: https://sonar-ctao.zeuthen.desy.de with: args: > + -Dsonar.projectVersion=${{ env.PROJECT_VERSION }} -Dsonar.scm.revision=${{ github.event.workflow_run.head_sha }} -Dsonar.pullrequest.key=${{ env.PR_NUMBER }} -Dsonar.pullrequest.branch=${{ env.SOURCE_BRANCH }}