Github PR decoration fails due to missing SONAR_TOKEN

Template Description

I’m trying to set up Pull Request decoration on our github repo, till recently where I want the sonar scanner to be executed on PR. For some reason it fails:

Error: Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:4.0.0.4121:sonar (default-cli) on project primefaces: Project not found. Please check the 'sonar.projectKey' and 'sonar.organization' properties, the 'SONAR_TOKEN' environment variable, or contact the project administrator to check the permissions of the user the token belongs to

I’m admin on sonarcloud for this repo but commiters in github, yet I’m pretty sure SONAR_TOKEN is set (since it’s always been working). The build works on master, but not on PR branch.

Thanks for your help

Hi,

I see that you’re providing the organization as a command line parameter. Are you using the ‘natural’ project key from the pom? Because the error message covers more than just the token:

Also, I see that you’re providing a token on the command line, but for GHActions, it may be that you need to provide the token as an envvar. Could that be the difference between your working full analysis and your non-working PR analysis?

Thanks for your answer, i’ll get back to it after this (since there might be an easy to achive this):

I received a notification https://tinyurl.com/mvkfdmzf, seems it’s possible from now on to execute PR analysis on external PRs, I followed the instructions:

For existing projects:

  • Go to your project’s Administration > Analysis Method page and turn on Automatic Analysis.
  • The Analysis Method page will display a compatibility check, so you are aware of our recommendations for your specific project.

But “Automatic Analysis” doesn’t show on sonarcloud, normal?

Hi,

We try to keep it to one topic per thread. Otherwise it can get messy, fast.

Please create a new thread for this new question.

 
Thx,
Ann