Scan branch and pull request together in GitHub

Hi,

I would like to know if there is any way to update the sonar report for a pull request and its respective branch in only one scan.

Scenario:

  1. I have a branch, and I send a scan for that branch to Sonar.

  2. Then I create a pull request based on that branch and I send a scan for that PR to Sonar.

  3. Then I make some changes in the branch and I want to update bot Sonar reports.

After making some changes in the branch, if I send a Sonar scan for the PR, it doesn’t update the branch report in Sonar and vice versa, if I update the branch report it doesn’t update the PR report.

When I try to pass branch and pull request parameters to the scan I get the error:

“A pull request analysis cannot have the branch analysis parameter ‘sonar.branch.name’”

It works if I make two separated scans, but I would prefer to make only one scan since both reports are affected by the same changes. Is there any way to achieve that in only one scan?

We use Sonar v7.4.0 Developer Edition

Thanks,

Agustin

Hi,

As of today it’s not possible to create a branch and a pull request analysis with a single scan. You must do two scans, one with the required parameters for branch analysis, and another one with the required parameters for pull request analysis.

Regards,
Janos