# Configuring Merge Queue on GitHub for Branch Protection

* **EasyCLA** is a tool that automates the enforcement of Contributor License Agreements (CLAs) in open-source projects.
* The tool integrates with GitHub and other platforms to verify CLA compliance automatically.
* To enable this feature, EasyCLA App will need read-only access to the Merge Queue. This permission is essential for the proper functioning of the integration.

<details>

<summary>Importance of Using a Merge Queue for Controlled PR Merging</summary>

* **Merge Queue** helps streamline the process of merging pull requests (PRs) in a controlled and efficient manner.
* It ensures that PRs are merged in a sequential order, reducing conflicts and maintaining code stability.
* The feature automatically revalidates PRs against the latest branch state before merging, preventing integration failures.
* Helps maintain a clean and stable main branch, especially in high-collaboration projects.
* Reduces manual intervention and accelerates the CI/CD pipeline by handling multiple PRs systematically.

</details>

### **Pre-requisites**

* GitHub organization with administrative access.
* EasyCLA GitHub App installed and configured.
* Repository branch protection rules available.

### Enabling EasyCLA Permissions

To ensure that the feature works correctly, you must approve the required permissions for the EasyCLA app.

If these permissions are not accepted, you may see an **"Expected"** status for the EasyCLA check in the Merge Queue, preventing the pull request from merging.

<figure><img src="https://3411187760-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M2DCN9UgoRgMEkgnLyP-887967055%2Fuploads%2Fgit-blob-04d41b18cc38a8fd1b5f8d585f733c7396e2e565%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

To enable the feature, follow these steps:

1. Access GitHub organization.
2. Select Settings.
3. Select GitHub Apps.
4. EasyCLA will show an update pending:

<figure><img src="https://3411187760-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M2DCN9UgoRgMEkgnLyP-887967055%2Fuploads%2Fgit-blob-7bfae1bd6a53cc08b1df64f27bbc9bf3940d259d%2Fimage2024-12-16_10-57-48.png?alt=media" alt=""><figcaption></figcaption></figure>

5. Select Review request link.
6. Accept the permissions:

<figure><img src="https://3411187760-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M2DCN9UgoRgMEkgnLyP-887967055%2Fuploads%2Fgit-blob-58ae5ef5421266823d2205103c149c95d1900cb9%2Fimage2024-12-16_10-58-48.png?alt=media" alt=""><figcaption></figcaption></figure>

7. Before proceeding, check the **EasyCLA app** and confirm that there are no pending permission requests.
   * If there are pending permissions, they should be approved to ensure Merge Queue correct functionality with **EasyCLA**.
   * If no permissions are pending, proceed to **Enabling Merge Queue on GitHub**.

### Enabling Merge Queue on GitHub

1. Navigate to the GitHub organization repository.
2. Go to **Settings** → **Branches**.

<figure><img src="https://3411187760-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M2DCN9UgoRgMEkgnLyP-887967055%2Fuploads%2Fgit-blob-c478ed464a0ee19b6d7a87c969af3c6d7affcf07%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

3. Click **Add rule** under **Branch protection rules**.

<figure><img src="https://3411187760-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M2DCN9UgoRgMEkgnLyP-887967055%2Fuploads%2Fgit-blob-8f01e31ca4456602ae53b84a60028b91f6de181a%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

4. On the next page, complete following steps:

* Add **Branch name pattern**
* Click **Require a pull request before merging** checkbox
* Click **Require status checks to pass before merging** and select **EasyCLA.**
* Click **Require merge queue** and update the setting&#x73;**.**
* Click **Create.**

For more information, see [managing a merge queue](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/managing-a-merge-queue).

<figure><img src="https://3411187760-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M2DCN9UgoRgMEkgnLyP-887967055%2Fuploads%2Fgit-blob-3d9beaff25ec409f340555eea71585356aa884b5%2Fvideo_01(10).gif?alt=media" alt=""><figcaption></figcaption></figure>

### Merging a Pull Request Using Merge Queue

For more information, see [Merging a pull request using merge queue](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/merging-a-pull-request-with-a-merge-queue).
