ci(sonarcloud): add SonarCloud analysis with Quality Gate on PRs - #31
Merged
Merged
Conversation
… PRs - New .github/workflows/sonarcloud.yml: dotnet-sonarscanner begin/build/ test/end on push to main, pull requests and manual dispatch. - sonar.qualitygate.wait=true on pull_request events only: the Sonar way gate evaluates new code, so a red build means the PR introduced issues. The first push to main is the baseline (everything counts as new) and must not block CI on pre-existing debt. - PR parameters are passed explicitly because the scanner does not auto-detect GitHub Actions. - Job is skipped for Dependabot and fork PRs (no repository secrets). - fetch-depth: 0 so SonarCloud gets blame data for new-code detection. - .sonarqube/ added to .gitignore (scanner working directory).
github.event.pullrequest.number does not exist (the pull_request payload key uses an underscore); the empty value made the scanner reject sonar.pullrequest.key and abort the analysis.
|
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
.github/workflows/sonarcloud.yml: SonarScanner for .NET (begin → build → test with coverage → end) onpushto main,pull_requestandworkflow_dispatch.sonar.qualitygate.wait=trueon PR events only — the Sonar way gate evaluates new code (Clean as You Code), so a red check here means this PR introduced issues. The first push to main is the baseline (everything counts as new) and must not block CI on pre-existing debt.fetch-depth: 0gives SonarCloud the blame data needed for new-code detection..sonarqube/(scanner working dir) added to.gitignore.Setup already done
santidev21imported/bound to GitHub; projectsantidev21_SplitItcreated.SONAR_TOKENrepository secret configured.Not touched
ci.ymlgates (tests, format, coverage, Trivy, Gitleaks) remain the source of truth.