Skip to main content
All CollectionsCode Review Automation
Monitor your code with automatic reviews
Monitor your code with automatic reviews

Use webhooks to trigger code reviews automatically

Gabriele Gallo Stampino avatar
Written by Gabriele Gallo Stampino
Updated this week

Clayton helps you maintain code quality automatically by monitoring changes in your repository, scanning app metadata, and applying fully configurable rules to ensure your code remains free from issues. For more information on How the Clayton code reviews work please check out this document.

Clayton utilizes webhooks in your version control system to monitor specific Git events and trigger real-time reviews.

How to enable automated code reviews

Clayton creates webhooks automatically to monitor relevant events in your repository. To set up the automation, please do the following steps:

Start by selecting the project from the homepage. Navigate to Settings and then Protection. Here, you can view the current settings and adjust the protection mode as needed.

There are four protection modes to choose from based on your project's needs. Observe Discreetly allows Clayton to collect insights without interfering with developers, ideal for audits over time. Make Suggestions enables Clayton to oversee development and provide optional suggestions for pull requests, perfect for teams not yet required to comply with standards or trying Clayton for the first time. Request Changes ensures Clayton oversees developments and requests changes to pull requests when necessary, making it suitable for long-running projects where compliance with standards moving forward is essential, but addressing legacy code issues is optional. Lastly, Full Compliance requires Clayton to oversee developments, request changes to pull requests, and address legacy code issues, best suited for new applications or rigorous teams committed to full compliance with standards.


Protection mode behaviours

Mode

Description

When to use?

Observe discreetly

Collect insights without interfering with developers.

Audits over a period of time

Make suggestions

Oversee developments and suggest changes to Pull Requests when relevant.

  • Addressing any issues is optional.

  • No need to comply with standards yet

  • Trying out Clayton the first time

Protect what's new

Oversee developments and request changes to Pull Requests if needed. Addressing issues with legacy code is optional.

  • Comply with standards moving forward

  • Best for long-running projects

  • Best when technical debt is not a priority

Full compliance

Oversee developments and request changes to Pull Requests if needed. Addressing issues with legacy code is required.

  • Comply with standards fully

  • Best for new applications

  • Best for rigorous teams

PRO TIP: Don't forget to configure the settings in the More Options section to make sure never to miss a review:




More options

By default, all Pull Requests are reviewed regardless of their target branch, but enabling the option to scan PRs only when the destination is a tracked branch restricts automated reviews to specific branches you choose to track. Additionally, while PR reviews are typically amended whenever new commits are pushed to the head branch, you can adjust the setting to amend reviews only when issues are added or resolved. For inline comments, you have three options: "On" includes all inline comments, "Limited" displays up to 20 inline comments alongside the Scan Summary, and "Off" provides only the Scan Summary without any inline comments.


Scan Summary

Clayton's Scan Summary provides an overview of code analysis results, highlighting detected issues and their severity levels to help developers quickly identify and address potential problems in their codebase. The tool also offers configurable inline comments to tailor feedback visibility: the On setting enables all inline comments, and Limited displays up to 20 inline comments along with the Scan Summary. These options allow teams to customize the review process to suit their preferences and workflow.


Track your branches

Please note that only pull requests created towards branches that are tracked in Clayton are reviewed automatically. Make sure to track all your integration branches to protect every new development and enforce best practices at earlier stages.

Quality Gate


Setting up a quality gate is a powerful way to enforce code quality standards across your project by embedding automated checks directly into your Git workflow. Quality gates act as checkpoints, preventing code that hasn’t passed reviews from being merged into critical branches, ensuring that only high-quality code reaches these main areas. Gates trigger via webhooks when new pull requests are created, allowing you to make quality checks mandatory and protect key branches from potential issues. Clayton supports both branch-based and diff-based quality gates, which can be used separately or combined for granular control over code quality. This setup helps maintain project consistency, reduces the risk of introducing issues, and streamlines the development workflow. If you need assistance setting up a quality gate, feel free to contact support.

Did this answer your question?