Github not getting status checks / PR decoration

Hi we are using GitHub for our SCM and TeamCity for CI. Our Repo’s are TypeScript / JavaScript.

We have a build step in TeamCity in which we call the sonar-scanner tool to kick off the analysis. The command is like this:

sonar-scanner -Dsonar.sourceEncoding="UTF-8""SONAR_URL" -Dsonar.organization="OUR_ORG" -Dsonar.login="AUTH_TOKEN""BRANCH_NAME""TARGET_BRANCH" -Dsonar.projectKey="PROJECT_NAME"

We run this for both PR’s and commits to feature branches. In the case of a PR we are setting to the PR,ex. pull/10 and to the target branch, ex. release/1.0.

In the case of a commit to a feature branch the & are both set to the feature branch, ex. feat/1.0/123/CoolNewFeature.

We are expecting to get the analysis reports back into our GitHub PR’s with Quality gate for pass / fail for our GitHub status checks but we don’t get anything.

I created a new project and imported that from GitHub to Sonar cloud and ran the automatic analysis, and the new project seems to get something at least. For example if I try to add a Require status checks to pass before merging rule to a branch I can see SonarCloud Code Analysis as an option, where as we don’t get that with any of our other projects.

I’m pretty sure that we have done something wrong, but I’ve spent a couple days digging around and not finding the right answer, so I’m hoping someone with some more knowledge can help / point in the right direction.

Hello @JoeVaughan96,

Your assumption that the same properties shall be provided for branch analysis and pull request analysis (and decoration) is wrong.
For pull request you but provide 2 different properties (in replacement of and

  • sonar.pullrequest.key: the number of the pull request
  • sonar.pullrequest.branch: the associated branch
  • Optionally sonar.pullrequest.base: the target branch if not the main branch


Hope this helps.

Hi Oliver,

Thanks that is useful.

I created a branch: test made a change committed it to test then created a PR to merge into branch release/1.0.

Then ran sonar-scanner with


It does seem to be better, I can see the PR analysis in SonarCloud now but I still don’t see any PR decoration on GitHub.

Okay I found the reason why the analysis is not being added to our PRs. We created the projects in sonar cloud via the CLI and the projects were not linked with our repos.

I’ve seen a few other threads of people with similar issues, and it looks like the only way to generate the link between the sonar cloud project and the GitHub repo is by importing via the UI. This is not scaleable. This will introduce a manual step every time we create a new repo.

Are there any plans to create the link via the cli or the api?

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.