Read Anthropic’s case study about Graphite Reviewer

how to track pull request approval rates in GitHub

Sara Verdi
Sara Verdi
Graphite software engineer


Note

This guide explains this concept in vanilla Git. For Graphite documentation, see our CLI docs.


Tracking pull request (PR) approval rates in GitHub provides insights into team productivity and the quality of code being merged. Approval rates refer to the percentage of pull requests that successfully pass code review, and this metrics helps you evaluate how fast and effectively your team approves code for production.

This guide covers the most effective ways to track PR approval rates in GitHub using native GitHub features and third-party tools, as well as some easy-to-follow examples for developers of all skill levels.

Understanding your GitHub PR approval rates allows you to:

  • Measure code review efficiency and team collaboration.
  • Identify bottlenecks in the review process, such as too many revisions or unclear feedback.
  • Gain insights into the quality of code submitted.
  • Set benchmarks for improving the code review process.

By measuring approval rates in GitHub, teams can optimize the workflow to ensure that high-quality code is shipped without unnecessary delays.

While GitHub offers limited analytics reporting natively, you can use tools like Graphite Insights to access more in-depth, customizable metrics around your code review process.

  1. Log In to Graphite

    • Navigate to Graphite and log in to your account.
    • If you don't have an account, you can sign up and connect your GitHub repositories.
  2. Access the Insights Dashboard

    • Once logged in, click on the "Insights" tab in the main navigation menu.
    • This dashboard provides transparent and customizable statistics to help measure and improve your team's engineering efficiency.
  3. Adjust the Time Period

    • At the top of the Insights page, select the time frame for which you want to view data.
    • You can choose from predefined periods like Past Week, Past Month, Past Quarter, or Past Year.
    • For a specific range, use the custom date picker to set your desired start and end dates.
      • Note: Graphite provides up to two years of historical data. If you select a period beyond this range, some data may be missing, and a warning banner will appear.
  4. Select Users or Teams

    • Use the "Filter" option to select specific users, teams, or view data across your entire organization.
    • This allows you to analyze individual or group performance metrics.
  5. View Approval Rates and Other Metrics

    • The Insights dashboard displays a variety of aggregated statistics for the selected users and time period, including:

      • Total PRs Merged: The total number of pull requests merged.
      • Average PRs Merged per Person: Average number of pull requests merged by each person.
      • Average PRs Reviewed per Person: Average number of pull requests reviewed by each person.
      • Median Publish to Merge Time: The median time from when a PR is published to when it is merged.
      • Median Review Response Time: The median time it takes for reviewers to respond to a PR.
      • Median Wait Time to First Review: The median time a PR waits before receiving its first review.
      • Average Number of Review Cycles Until Merge: Average review iterations before a PR is merged.
    • Graphs are also available to visualize:

      • Number of PRs Reviewed per Person Over Time
      • PRs Reviewed by Graphite Users vs. Non-Graphite Users
      • Number of PRs Merged per Person Over Time
      • PRs Merged by Graphite Users vs. Non-Graphite Users
  6. Calculate Approval Rates

    • While Graphite provides detailed metrics, you can calculate the approval rate using the available data:

      - Approval Rate Formula:

      Approval Rate = (Total PRs Merged / Total PRs Submitted) × 100

      - Steps: - Identify the Total PRs Merged from the dashboard. - Determine the Total PRs Submitted. If this metric isn't directly available, you may infer it from other data or consult your team's records. - Apply the formula to calculate the approval rate.

  7. Create, Save, and Share Custom Views

    • To tailor the Insights dashboard to your needs:
      • Click on "Create View" to set up a custom view with specific filters and time periods.
      • Name your custom view for easy reference.
      • To share this view with teammates:
        • Click the "Link" icon next to the view's name to copy a permalink.
        • Share the link with your team members so they can access the same insights.
  8. Analyze Individual User Data

    • For detailed insights on individual performance:
      • Scroll down to the Individual User section.
      • Click on a user's name to view their specific statistics and contribution graphs.
      • This transparency helps team members understand their impact and identify areas for improvement.

Other third-party tools can make PR approval tracking in GitHub easier and more comprehensive. Below are some popular tools to consider:

Code Climate Velocity provides team metrics and can track PR approval efficiency across different teams and projects. It also offers insights into how long reviews take and helps identify blockers in the approval process. You could use Code Climate to create a chart that visualizes the percentage of PRs approved within 24 hours versus those requiring multiple revisions, helping teams prioritize faster feedback loops.

ZenHub is a project management platform integrated with GitHub, allowing teams to track workflows and approvals. Using ZenHub’s reporting features, you can monitor PR approval rates as part of your broader project management insights. With ZenHub’s reporting tools, you can, for example, generate reports that track PR approval rates and review efficiency, displaying them alongside issue tracking and sprint performance.

After you start measuring approval rates in GitHub, it’s essential to set benchmarks to improve your team's code review process. For example:

  • Aim for at least an 80% approval rate for pull requests within the first review.
  • Set goals to reduce the number of PRs requiring more than two reviews.
  • Track PR approval times to ensure most approvals happen within a specific window (e.g., 48 hours).

You should use these benchmarks to continuously improve your team’s workflow and guarantee faster, higher-quality merges.

Tracking pull request approval rates in GitHub helps teams measure their efficiency, identify blockers, and improve code quality. By leveraging GitHub PR approval tracking through GitHub's insights, API queries, and third-party tools like Graphite or Code Climate, teams can maintain clear visibility into their code review process. Regularly measuring approval rates and setting actionable benchmarks ensures that code reviews remain streamlined and effective.

Graphite
Git stacked on GitHub

Stacked pull requests are easier to read, easier to write, and easier to manage.
Teams that stack ship better software, faster.

Or install our CLI.
Product Screenshot 1
Product Screenshot 2