GITHUB_TOKEN needed for running things in master?

Must-share information (formatted with Markdown):
Sonarqube version:

  • Sonarqube 7.9.6 enterprise version
  • what are you trying to achieve
  • analysis on master/main branches
  • what have you tried so far to achieve this
  • Run from branches/pull-requests and on default branches (master/main)

Hello everyone. We upgraded to the enterprise version of 7.9.6 from the community version. However, we noticed that all the analysis that was happening in master/main started to fail, saying that it needed the GITHUB_TOKEN env variable.

Things that we noticed:
We have builds running on Jenkins, and then builds running using github actions. The ones in github actions are failing (as mentioned) but the builds in Jenkins are running successful. We have confirmed that the jenkins nodes do not have the GITHUB_TOKEN environment variable.

Another thing that we noticed is that as long as the environment variable is there, it doesn’t matter if the key is correct or not. We are using our internal action for running sonarqube analysis (mostly using the gradle plugin) so we’re not quite sure how the sonarqube server is able to detect this.

The question from our end is if there’s any official documentation on this environment variable and how it’s used or why it’s needed by the server to run analysis?

There’s a line in the example

          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}  # Needed to get PR information, if any

but even in pull requests and branches it is working without this env variable. but not in master/main.


Your version is past EOL. You should upgrade to either the latest version or the current LTS at your earliest convenience. Your upgrade path is:

7.9.6 → 8.9.8 → 9.4 (last step optional)

You may find the Upgrade Guide and the LTS-to-LTS Upgrade Notes helpful. If you have questions about upgrading, feel free to open a new thread for that here.

If your error persists after upgrade, please come back to us.

We will try the upgrade. But it seems like the GITHUB_TOKEN is still needed together with the Github App. And still there’s not much documentation about why both are needed (only the Github App)

Hi, @Colin a simple question regarding Sonarqube 7.9.6 (I know it’s not the LTS version) but in the docs, it only specifies Github Enterprise for the github integration and I wonder if it means github enterprise server (self hosted) or if it should work with github enterprise cloud?