.github/workflows/sonar.yml: Disable caching (for now) and only create directory if it doesn't already exist (#879)
diff --git a/.github/workflows/sonar.yml b/.github/workflows/sonar.yml
index c9c9799..8dcbb3a 100644
--- a/.github/workflows/sonar.yml
+++ b/.github/workflows/sonar.yml
@@ -46,26 +46,27 @@
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- - name: Cache SonarCloud packages
- uses: actions/cache@v3
- with:
- path: ~\sonar\cache
- key: ${{ runner.os }}-sonar
- restore-keys: ${{ runner.os }}-sonar
- - name: Cache SonarCloud scanner
- id: cache-sonar-scanner
- uses: actions/cache@v3
- with:
- path: .\.sonar\scanner
- key: ${{ runner.os }}-sonar-scanner
- restore-keys: ${{ runner.os }}-sonar-scanner
+ #- name: Cache SonarCloud packages
+ # uses: actions/cache@v3
+ # with:
+ # path: ~\sonar\cache
+ # key: ${{ runner.os }}-sonar
+ # restore-keys: ${{ runner.os }}-sonar
+ #- name: Cache SonarCloud scanner
+ # id: cache-sonar-scanner
+ # uses: actions/cache@v3
+ # with:
+ # path: .\.sonar\scanner
+ # key: ${{ runner.os }}-sonar-scanner
+ # restore-keys: ${{ runner.os }}-sonar-scanner
- name: Install SonarCloud scanner
#if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
shell: powershell
run: |
- New-Item -Path .\.sonar\scanner -ItemType Directory
+ $dir = '.\.sonar\scanner'
+ if (!(Test-Path $dir)) { New-Item -Path $dir -ItemType Directory }
# NOTE: Using 5.8.0 when the sonar scan was first added because that is likely the version that was in the cache
- dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner --version 5.8.0
+ dotnet tool update dotnet-sonarscanner --tool-path $dir --version 5.8.0
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any