Start Free
SonarQube Community Build | DevOps platform integration | GitHub integration | Setting up integration at project level

Setting up GitHub integration features at the project level

On this page

This section explains how to set up various GitHub integration features for a given project.

Preventing pull request merges when the quality gate fails

In GitHub, you can block pull requests from being merged if it is failing the quality gate. To do this:

  1. In GitHub, go to your repository Settings > Branches > Branch protection rules and select either the Add rule or Edit button if you already have a rule on the branch you wish to protect.
  2. Complete the Branch protection rule form:
    • Define the Branch name pattern (the name of the branch you wish to protect)
    • Select Require status checks to pass before merging to open supplementary form fields.
    • In the Search for status checks in the last week for this repository field, select Require branches to be up to date before merging, then find SonarQube Code Analysis and add it to the list of required checks.

Showing your analysis summary under the GitHub Conversation tab

For bound projects, the pull request analysis can also be shown under the Conversation tab in addition to the Checks tab in GitHub. 

To show the analysis summary of a bound project in GitHub also under the Conversation tab:

  • In Project settings > General settings > Enable analysis summary under the GitHub Conversation tab, make sure that the Enable analysis summary under the GitHub Conversation tab option is on (default value). 

Reporting your quality gate status in GitHub for unbound projects

On projects bound to their GitHub repository, SonarQube Community Build automatically sets up the report of your quality gate status and analysis metrics directly to your GitHub pull requests. For unbound projects, you must set up the quality gate status manually as explained below.

SonarQube Community Build can also report your quality gate status to GitHub pull requests for existing and manually created projects provided the integration of SonarQube Community Build with GitHub has been properly set up. Proceed as follows:

  1. In the SonarQube Community Build project page, select Project Settings > General Settings > DevOps Platform Integration.
  2. Set:

Was this page helpful?

© 2008-2024 SonarSource SA. All rights reserved. SONAR, SONARSOURCE, SONARQUBE, and CLEAN AS YOU CODE are trademarks of SonarSource SA.

Creative Commons License