Sonar Cloud Analysis #592
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Sonar Cloud Analysis | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- "**.cs" | |
- "**.sln" | |
- "**.csproj" | |
- ".github/workflows/sonarcloud-analysis.yml" | |
pull_request: | |
types: [opened, synchronize, reopened] | |
paths: | |
- "**.cs" | |
- "**.sln" | |
- "**.csproj" | |
- ".github/workflows/sonarcloud-analysis.yml" | |
schedule: | |
- cron: "21 21 * * 2" | |
permissions: | |
contents: read | |
concurrency: | |
group: ${{ github.ref }}-${{ github.workflow }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
name: Sonar Cloud Analysis | |
permissions: | |
contents: read # for actions/checkout to fetch code | |
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results | |
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
- name: "⚙️ Install GitVersion" | |
uses: gittools/actions/gitversion/setup@v0.10.2 | |
with: | |
versionSpec: "5.x" | |
- name: "⚙️ Execute GitVersion" | |
id: gitversion | |
uses: gittools/actions/gitversion/execute@v0.10.2 | |
- name: "⚙ Display the version" | |
run: | | |
echo "Version: ${{ steps.gitversion.outputs.semVer }}" | |
- uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: "6.0.x" | |
- name: Check dotnet sdk install | |
run: dotnet --info | |
- name: Install dependencies | |
run: dotnet restore | |
- name: SonarCloud Scan | |
uses: SonarSource/sonarcloud-github-action@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |