Skip to main content

Issues and PRs > Required approvals

Tom Williams avatar
Written by Tom Williams
Updated this week

Dataset: Issues & Pull Requests

Entity: Pull Requests

Field ID: required_approval_count

Type: Integer

Description: The number of approvals this pull request requires before it can be considered approved. For issues, the value is calculated from resolving pull requests.

Source: App (Pull requests) / Calculated (Issues)

Transformation logic:

  • Pull Requests: use the approval settings from the source application. It is defaulted to 1 if null (no approval settings configured).

  • Issues: sum the required approvals of all resolving pull requests. Resolving pull requests are pull requests that reference the issue via auto-closing keywords.

From:

Github (PRs, Issues)

branchProtectionRule. requiredApprovingReviewCount

Gitlab (PRs, Issues)

merge_request_approvals.
approvals_required

Bitbucket (PRs)

None

Azure DevOps (PRs, Issues)

repositoryPolicies.minimumApproverCount

JIRA (Issues)

Inferred from resolving PRs

ClickUp (Issues)

Inferred from resolving PRs

Trello (Issues)

Inferred from resolving PRs

Reporting Use Cases

The Required Approvals field is a critical component for auditing your code review process and ensuring compliance with your quality standards. It provides the baseline for measuring whether a pull request has received sufficient approvals before being merged.

  • Auditing and Compliance: The most important use of this field is to compare it against the actual approvals a pull request received.

    • Find Non-Compliant Merges: You can create a high-priority audit report of all merged pull requests that did not meet the minimum approval rule. To do this, create a filter where state = "MERGED" and then use a custom formula dimension with approval_count < required_approval_count.

    • PR Review Ratio: This field is the foundation for calculating your team's overall "PR Review Ratio." A custom formula like ROUND(AVG(IF(required_approval_count == 0, 1, (required_approval_count - required_approval_remaining_count) / required_approval_count)), 2) * 100 gives you the percentage of required approvals that were met across all merged pull requests.

  • Analyzing Review Policies: Using this field as a dimension allows you to understand how your review requirements are configured across different projects.

    • A bar chart with project_name as the dimension and AVG(required_approval_count) as the metric can show you the average number of approvals required for each of your repositories, helping you spot inconsistencies in your policies.

  • Filtering by Review Threshold: You can create reports that focus only on pull requests that have a formal review process.

    • To exclude pull requests that can be merged without any reviews, you can use a filter like Required Approvals > 0. This helps you focus your analysis on work that is subject to your team's formal review process.

Did this answer your question?