Skip to main content
Create a quality gate with GitHub

Learn how to create a quality gate that will only let merge code that passes Clayton's reviews.

Lorenzo Frattini avatar
Written by Lorenzo Frattini
Updated over a week ago

What is a quality gate?

A quality gate is the best way to enforce a quality policy in your organization. Setting up a quality gate allows you to prevent any code that doesn't pass code reviews from being merged into certain branches.

Key Benefits

  • Enforce code quality consistency across the entire project

  • Ensure that newly committed code doesn't introduce problems

  • Ensure issues are addressed before being merged

Before to start

Before proceeding with creating a quality gate in your VCS for your repo, you must enable Clayton Automation and create a dedicated Clayton connection user for your project.

GitHub App

Please have a look at our Help Article to learn how to set up our official app.

Enable Automation

Make sure to activate the Clayton Automation to monitor your code and start using webhooks to publish status updates for the PR and branch reviews on your VCS.
Please have a look at the dedicated Help Article to learn how to enable automation.

Steps

  1. In your repository settings in GitHub, go under Settings  > Branches

  2. In the Branch protection rules section, click on Add rule

  3. In the Branch name pattern field, type the branch name you would like to create the gate for

Suggested Setup

  1. Configure the desired number of approvals
    Example: If all your PRs need to be approved by your architect, configure 2 required approvals: 1 for your architect and 1 for Clayton.

  2. Configure the required Status Checks.
    Example: start enforcing security-related checks (e.g. Secure policy).

  3. Check the Dismiss stale pull request approvals when new commits are pushed flag to ensure that new developments are validated.

  4. Click on Save

Did this answer your question?