Commit c92932f
committed
Default sonar.branch.name to the current git branch
Without sonar.branch.name set, `./gradlew sonar` posts the analysis
to whatever the SonarCloud project's main branch is. So local runs
from a feature/bugfix branch silently overwrite the main branch's
quality gate snapshot — which is what you noticed during the rebase
work on develop.
Derive sonar.branch.name from the current git ref at config time:
- if -Psonar.branch.name=… is already passed (CI does this), honor it
- else read GITHUB_REF_NAME or GITHUB_HEAD_REF if set
- else run `git rev-parse --abbrev-ref HEAD`
- if everything resolves to "HEAD" (detached, no useful ref), leave
sonar.branch.name unset so SonarCloud falls back to its configured
main branch rather than getting a garbage value
CI keeps explicitly overriding via -P in build-artifacts.yml, so this
only changes behavior locally and on workflows that don't pass the
flag.1 parent 26c8890 commit c92932f
1 file changed
Lines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
387 | 387 | | |
388 | 388 | | |
389 | 389 | | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
390 | 408 | | |
391 | 409 | | |
392 | 410 | | |
| |||
0 commit comments