I’m setting up a new .NET C# project in SonarCloud and the scan runs successfully in a GitHub Action and I can see the PRs appearing in SonarCloud and the SonarCloud comment appearing in GitHub.
However, my “main” (dev) branch analysis results are not reported. I only see the message:
“dev” branch has not been analyzed yet and you have multiple branches already. It looks like it is not your Main Branch, check your configuration.
My trigger in the GitHub action looks like this:
name: SonarCloud Build
on:
push:
branches:
- dev
pull_request:
types: [opened, synchronize, reopened]
However even after merging the my GitHub action YAML with that trigger to my dev branch, the analysis results do not appear in SonarCloud.
Am I missing something else?
- ALM used: GitHub
- CI system used: Azure DevOps, GitHub Actions
- Scanner command used:
.\.sonar\scanner\dotnet-sonarscanner begin /k:"[project key]" /o:"[org name]" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml
dotnet build --no-incremental [solution name]
dotnet-coverage collect 'dotnet test' -f xml -o 'coverage.xml'
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
- Languages of the repository: C#