Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.

Commit 1723804

Browse files
authored
Merge pull request #387 from microsoftgraph/feature/sonar-token
- replaces sonar login by token
2 parents 845153c + 013ad63 commit 1723804

File tree

1 file changed

+3
-14
lines changed

1 file changed

+3
-14
lines changed

.github/workflows/sonarcloud.yml

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -51,28 +51,17 @@ jobs:
5151
path: ~/.sonar/cache
5252
key: ${{ runner.os }}-sonar
5353
restore-keys: ${{ runner.os }}-sonar
54-
- name: Cache SonarCloud scanner
55-
id: cache-sonar-scanner
56-
uses: actions/cache@v4
57-
with:
58-
path: ./.sonar/scanner
59-
key: ${{ runner.os }}-sonar-scanner
60-
restore-keys: ${{ runner.os }}-sonar-scanner
6154
- name: Install SonarCloud scanner
62-
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
63-
shell: pwsh
64-
run: |
65-
New-Item -Path ./.sonar/scanner -ItemType Directory
66-
dotnet tool update dotnet-sonarscanner --tool-path ./.sonar/scanner
55+
run: dotnet tool install dotnet-sonarscanner --create-manifest-if-needed
6756
- name: Build and analyze
6857
env:
6958
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
7059
CollectCoverage: true
7160
CoverletOutputFormat: 'opencover' # https://github.com/microsoft/vstest/issues/4014#issuecomment-1307913682
7261
shell: pwsh
7362
run: |
74-
./.sonar/scanner/dotnet-sonarscanner begin /k:"microsoftgraph_msgraph-cli-core" /o:"microsoftgraph2" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths="**/*.Tests/**/coverage.opencover.xml" /d:sonar.coverage.exclusions="src/sample/**"
63+
dotnet tool run dotnet-sonarscanner begin /k:"microsoftgraph_msgraph-cli-core" /o:"microsoftgraph2" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths="**/*.Tests/**/coverage.opencover.xml" /d:sonar.coverage.exclusions="src/sample/**"
7564
dotnet workload restore
7665
dotnet build
7766
dotnet test msgraph-cli-core.sln --no-build --verbosity normal /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
78-
./.sonar/scanner/dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
67+
dotnet tool run dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"

0 commit comments

Comments
 (0)