Skip to main content

Issues and PRs > Approvals

Tom Williams avatar
Written by Tom Williams
Updated over a week ago

Dataset: Issues & Pull Requests

Entity: Pull Requests, Issues

Field ID: approval_count

Type: Integer

Description: The number of peer review approvals received on this pull request. For issues, the count is the sum of approvals from resolving pull requests.

Source: Calculated from pull request reviews

Transformation logic:

  • Pull requests: the number of pull request reviews in the APPROVED state. For a given reviewer, only the latest non-discarded review is considered (previous reviews are ignored).

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

From:

Github (PRs, Issues)

Calculated

Gitlab (PRs, Issues)

Calculated

Bitbucket (PRs)

Calculated

Azure DevOps (PRs, Issues)

Calculated

Required and optional reviewers both participate in the calculation.

JIRA (Issues)

Calculated from resolving PRs

ClickUp (Issues)

Calculated from resolving PRs

Trello (Issues)

Calculated from resolving PRs

Reporting Use Cases

The approval_count field is valuable for creating metrics and reports that help you understand and improve your code review processes.

Here are some ways you can use it:

  • Filtering and Compliance: You can filter pull requests based on the number of approvals they have received. For instance, you can create a report that lists all merged pull requests that did not meet the minimum required approvals by using a filter like approval_count < required_approval_count. This is a great way to audit and enforce your review policies.

  • Performance and Engagement Metrics: Since approval_count is a number, you can use it in a variety of calculations and aggregations to measure team performance. For example:

    • You can calculate the average number of approvals per pull request using AVG(approval_count) to gauge the overall engagement in the review process.

    • You could track the MAX(approval_count) to see which pull requests generated the most discussion and consensus.

    • It can also be used to create a KPI that monitors the percentage of pull requests merged with at least one approval: ROUND(COUNT_IF(approval_count > 0) / COUNT() * 100, 2).

  • Workload and Bottleneck Analysis: By combining approval_count with other dimensions, you can analyze review workload distribution. For example, a bar chart with author_username as a dimension and AVG(approval_count) as a metric can highlight if certain developers' pull requests consistently require more reviews than others, which could be an indicator of complexity or a need for mentoring.
    ​

Did this answer your question?