# Setting up integration at project level

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

## Preventing pull request merges when the quality gate fails <a href="#prevent-pull-request-merge" id="prevent-pull-request-merge"></a>

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 <a href="#analysis-under-github-conversation-tab" id="analysis-under-github-conversation-tab"></a>

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 <a href="#report-quality-gate-status" id="report-quality-gate-status"></a>

On SonarQube [Importing GitHub repositories](/sonarqube-server/10.7/devops-platform-integration/github-integration/importing-github-repositories.md), SonarQube 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 can also report your quality gate status to GitHub pull requests for existing and manually created projects provided the integration of SonarQube with GitHub has been [Introduction](/sonarqube-server/10.7/devops-platform-integration/github-integration/setting-up-at-global-level/introduction.md). Proceed as follows:

1. In the SonarQube UI page of your project, select **Project Settings > General Settings > DevOps Platform Integration**.
2. Set:
   * **Configuration name**: The name of your GitHub instance’s Configuration record set in Step 3 of [Setting up a GitHub App](/sonarqube-server/10.7/devops-platform-integration/github-integration/setting-up-at-global-level/setting-up-github-app.md) (Ask your admin.).
   * **Repository identifier**: The path of your repository URL.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sonarsource.com/sonarqube-server/10.7/devops-platform-integration/github-integration/setting-up-at-project-level.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
