Sonar-scan + codebuild + github + pull requests?

Using sonar-scanner in codebuild, I’m getting scan results to appear in SonarCloud, but they are not found under the pr’s destination branch (in this case, master)

I’m running like so:


with a file like so:

sonar.projectKey=<project key>
sonar.organization=<org name>
sonar.projectName=<project name>


Hey there.

I don’t quite understand what you mean – can you explain further, perhaps sharing screenshots as well?

Hi Colin, sorry, that might have been a bit confusing:

We run sonar-scanner for github pull requests.

What I expect to see is:

  1. The results of the analysis under Pull Requests within sonar cloud. Instead, I see this:

  1. I expect to see the PR annotated within github (like the following image), but I do not.

I hope that helps!

Okay! I assume you’re running the build through GitHub actions (correct me if I’m wrong)

  • Can you share the GitHub Actions YML file?
  • Do you see a SonarCloud analysis run in the context of your pull request build on GitHub?

Actually, I am running them through AWS Codebuild.

Thanks for the clarification.

In that case – to run analysis on pull requests (since AWS CodeBuild isn’t supported out of the box), you’ll need to specify that on pull request builds a few analysis parameters are added:

Typically these are derived from environment variables.