When running sonar-scanner in github actions merge checks, it correctly detects the branch and only reports issues from that branch, but when when the same PR is sent to the github merge queue, when we invoke the sonar-scanner the report is showing it as the main branch for the git repository.
Do we need to manually specify the branch in order for this to work in the github merge queue? It seems related to how for builds for a github merge queue can be grouped together and a temporary branch is created.
Does sonar-scanner/sonarcloud properly work for github merge queue?
I guess you found an unsupported case where our software doesn’t detect the real branch appropriately when in the merge queue. I’ll dig further into it.
As a workaround, and with a limited knowledge of the GitHub merge queue at the moment, could you try specifying the parameters manually?
If you are analyzing a pull request, the parameter is: -Dsonar.pullrequest.key=1234
If it is a regular branch, then it is: -Dsonar.branch.name=my/cool/branch