From 80a9376287b315c44e59a9b67763933bb838563e Mon Sep 17 00:00:00 2001 From: Robert Dailey Date: Fri, 24 May 2024 17:09:30 -0500 Subject: [PATCH] ci: Use the latest tag for SonarCloud versioning Configure SonarCloud to use the latest git tag as the version identifier instead of the current commit. This ensures that SonarCloud considers all code changes since the last tagged release, aligning with our setup to track new code issues from the most recent release. --- .github/workflows/sonarcloud.yml | 5 +---- ci/RunSonarScan.ps1 | 5 +++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 564a4c35..048941f6 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -20,14 +20,11 @@ jobs: sonarcloud: name: SonarCloud runs-on: ubuntu-latest - env: - DOTNET_ROLL_FORWARD: LatestMajor - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - name: Get Source Code uses: actions/checkout@v4 with: - fetch-depth: 0 # avoid shallow clone for GitVersion + fetch-depth: 0 # avoid shallow clone for GitVersion and Sonar analysis # GH Runners come with Java 11, which is deprecated by Sonarcloud - name: Setup Java diff --git a/ci/RunSonarScan.ps1 b/ci/RunSonarScan.ps1 index 1e228270..3f7a0097 100644 --- a/ci/RunSonarScan.ps1 +++ b/ci/RunSonarScan.ps1 @@ -6,8 +6,9 @@ param ( [switch] $Details ) -$version = $(dotnet gitversion /showvariable semver) -if ($LASTEXITCODE -ne 0) { throw "Failed: dotnet gitversion" } +# We use the current released version because we want to treat all code written since that version +# as 'new' for analysis purposes. +$version = (git describe --tags --abbrev=0) -replace '^v' $beginArgs = @( "-o:recyclarr"