コンテンツにスキップ

Pull Request を分析してレビュー効率とチームパフォーマンスを可視化する

pull-request-analytics-actionという GitHub Actions を使って、Pull Request のレビュー効率とチームパフォーマンスを可視化してみた。

チームと開発者個人の有効性を分析するための強力なツールです。このアクションは、プルリクエスト、コードレビュー、コメントのデータに基づいてレポートを生成し、チームの強みや改善が必要な分野を特定することができます。この GitHub アクションによって収集された統計情報は、表やグラフの形で表示したり、マークダウンやデータコレクションとして渡すことができます。情報は外部のサービスには転送されず、すべての操作は GitHub 環境内だけで行われます。このツールには多数の設定パラメータがあり、特定のプロジェクトのニーズに合わせてカスタマイズすることができます。

特徴

DeepL で翻訳したものを引用。

レビュータイムライン用のカスタマイズ可能な表とグラフ:PR 開始からレビュー、承認、マージまでの重要なマイルストーンを示すユーザーフレンドリーな表とグラフを生成します。ユーザーは、中央値、平均値(平均)、または選択したパーセンタイルから最適な計算方法を選択できます。この機能は、コードレビュープロセスのボトルネックの特定に役立ちます。

マージされた PR、コード変更、およびレビューに関する包括的なレポート:この機能は、マージされた PR の数、変更されたコードの行数、および実施されたレビューの詳細なレポートを作成します。これは、個々の開発者とチーム全体の作業負荷のおおよその尺度を提供し、生産性と貢献の明確なビューを提供します。

開発者によって開設された PR の品質レポート:この機能は、開発者によってオープンされた PR の品質を分析するレポートを生成します。このレポートは、受け取ったコメントの数、議論された内容、議論の理由、オープンな PR で要求された変更の量に関するデータを表とグラフの両方で表示します。この機能は、コードレビュー中に検出された最も問題のある領域を特定し、その程度を定量化するのに役立ちます。

コードレビュープロセスにおける開発者の関与:この機能は、コードレビューへの開発者の参加レベルを評価します。開始されたディスカッションやコメント、実施されたコードレビューの数や決定事項の内訳を表にして提供します。これにより、レビュープロセスへの開発者の関与を効果的に測定することができます。

主要メトリクスによる注目 PR リスト:pull-request-analytics-action の特筆すべき機能の 1 つは、4 つの主要メトリクス(オープンからレビューまでの時間、レビューから承認までの時間、承認からマージまでの時間、コメント数)に基づいて最も注目すべきプルリクエストのリストを生成する機能です。この機能は、これらの例外的な PR への直接リンクのリストを提供し、迅速なアクセスと詳細な分析を可能にします。

特定のプロジェクトのニーズに合わせて高度にカスタマイズ可能:このアクションは、柔軟性を念頭に設計されており、表示パラメータ、統計収集、およびレポート生成の広範なカスタマイズが可能です。ユーザーは、特定のプロジェクトの要件に正確に適合するようにツールを調整することができ、レポートと分析が可能な限り適切で有用であることを保証します。

GitHub 統合、セキュア、オープンソース:GitHub アクションとして、pull-request-analytics-action は完全に GitHub 環境内で動作します。外部サービスとデータを共有したり保存したりしないため、データのセキュリティとプライバシーが完全に守られます。さらに、オープンソースのツールであるため、動作の完全な透明性を提供し、無償で利用できるため、すべての GitHub ユーザーがアクセス可能です。

使い方

公式レポジトリの README に書いてある通りに記述して、そのワークフローを発火するだけで動く。

name: "PR Analytics"
on:
  workflow_dispatch:
    inputs:
      report_date_start:
        description: "Report date start(d/MM/yyyy)"
        required: false
      report_date_end:
        description: "Report date end(d/MM/yyyy)"
        required: false
jobs:
  create-report:
    name: "Create report"
    runs-on: ubuntu-latest
    steps:
      - name: "Run script for analytics"
        uses: AlexSim93/pull-request-analytics-action@master
        with:
          GITHUB_TOKEN: ${{ secrets.TOKEN }}
          GITHUB_REPO_FOR_ISSUE: "repo"
          GITHUB_OWNER_FOR_ISSUE: "owner"
          GITHUB_OWNERS_REPOS: "owner-1/repo-1"
          CORE_HOURS_START: "9:00"
          CORE_HOURS_END: "19:00"
          TIMEZONE: "Europe/Berlin"
          REPORT_DATE_START: ${{ inputs.report_date_start }}
          REPORT_DATE_END: ${{ inputs.report_date_end }}

この action を使うと、issue が作られ以下のようなレポートを作成することができる。

Pull Request report

This report based on 50 last updated PRs. To learn more about the project and its configuration, please visit Pull request analytics action.

Below are the settings applied for this report:

GITHUB_OWNERS_REPOS: owner/repo
GITHUB_OWNER_FOR_ISSUE: issue-owner
GITHUB_REPO_FOR_ISSUE: issue-repo
LABELS: Report
SHOW_STATS_TYPES: timeline, workload, pr-quality, code-review-engagement
TOP_LIST_AMOUNT: 3
AGGREGATE_VALUE_METHODS: percentile
PERCENTILE: 75
TIMEZONE: Europe/Berlin
CORE_HOURS_START: 10:00
CORE_HOURS_END: 19:00
AMOUNT: 50
PERIOD_SPLIT_UNIT: months
EXECUTION_OUTCOME: markdown

Pull requests timeline(percentile75) 12/2023

Time to review - time from PR creation to first review. Time to approve - time from PR creation to first approval without requested changes. Time to merge - time from PR creation to merge.

user Time to review Time to approve Time to merge Total merged PRs
dev1 3 hours 34 minutes 7 hours 32 minutes 14 hours 9 minutes 22
dev2 4 hours 4 hours 23 hours 1 minute 13
dev3 15 hours 16 minutes 24 hours 7 minutes 53 hours 43 minutes 2
dev4 2 hours 41 minutes 9 hours 15 minutes 47 hours 41 minutes 8
dev5 5 hours 59 minutes 18 hours 55 minutes 40 hours 7 minutes 2
total 4 hours 21 minutes 7 hours 36 minutes 26 hours 14 minutes 47
gantt
title Pull requests timeline(percentile75) 12/2023 / minutes
dateFormat X
axisFormat %s
section dev1
                Time to review(3 hours 34 minutes) :  0, 214
Time to approve(7 hours 32 minutes) :  0, 452
Time to merge(14 hours 9 minutes) :  0, 849

section dev2
                Time to review(4 hours) :  0, 240
Time to approve(4 hours) :  0, 240
Time to merge(23 hours 1 minute) :  0, 1381

section dev3
                Time to review(15 hours 16 minutes) :  0, 916
Time to approve(24 hours 7 minutes) :  0, 1447
Time to merge(53 hours 43 minutes) :  0, 3223

section dev4
                Time to review(2 hours 41 minutes) :  0, 161
Time to approve(9 hours 15 minutes) :  0, 555
Time to merge(47 hours 41 minutes) :  0, 2861

section dev5
                Time to review(5 hours 59 minutes) :  0, 359
Time to approve(18 hours 55 minutes) :  0, 1135
Time to merge(40 hours 7 minutes) :  0, 2407

section total
                Time to review(4 hours 21 minutes) :  0, 261
Time to approve(7 hours 36 minutes) :  0, 456
Time to merge(26 hours 14 minutes) :  0, 1574

longest-pending reviews

  1. Feature: PR Title(example) (7 hours 26 minutes)
  2. Feature: PR Title(example) (7 hours 20 minutes)
  3. Feature: PR Title(example) (7 hours 10 minutes)

longest-pending approvals

  1. Feature: PR Title(example) (2 hours 15 minutes)
  2. Feature: PR Title(example) (2 hours 7 minutes)
  3. Feature: PR Title(example) (2 hours 3 minutes)

longest-pending merge

  1. Feature: PR Title(example) (2 hours 33 minutes)
  2. Feature: PR Title(example) (2 hours 30 minutes)
  3. Feature: PR Title(example) (2 hours 12 minutes)

Workload stats 12/2023

Reviews conducted - number of reviews conducted. 1 PR may have only single review.

PR Size - determined using the formula: additions + deletions * 0.5. Based on this calculation: 0-50: xs, 51-200: s, 201-400: m, 401-700: l, 701+: xl

user Total opened PRs Total merged PRs Additions/Deletions PR size: xs/s/m/l/xl Total comments Reviews conducted
dev1 24 22 +1448/-3110 14/5/4/0/1 41 8
dev2 14 13 +813/-2062 7/4/1/2/0 6 20
dev3 2 2 +15/-3 2/0/0/0/0 1 10
dev4 8 8 +5416/-4600 6/0/1/0/1 7 9
dev5 2 2 +838/-362 1/0/0/0/1 16 2
total 50 47 +8530/-10137 30/9/6/2/3 71 46

Pull request quality 12/2023

Agreed - discussions with at least 1 reaction 👍.

Disagreed - discussions with at least 1 reaction 👎.

user Total merged PRs Changes requested received Agreed / Disagreed / Total discussions received Comments received
dev1 22 3 0 / 0 / 10 20
dev2 13 1 0 / 0 / 2 3
dev3 2 0 0 / 0 / 1 1
dev4 8 1 0 / 0 / 4 4
dev5 2 1 3 / 2 / 8 9
total 47 6 3 / 2 / 25 37

The most commented PRs

  1. Feature: PR Title(example)(18)
  2. Feature: PR Title(example)(16)
  3. Feature: PR Title(example)(15)

Code review engagement 12/2023

PR Size - determined using the formula: additions + deletions * 0.5. Based on this calculation: 0-50: xs, 51-200: s, 201-400: m, 401-700: l, 701+: xl

Changes requested / Comments / Approvals - number of reviews conducted by user. For a single pull request, only one review of each status will be counted for a user.

Agreed - discussions with at least 1 reaction 👍.

Disagreed - discussions with at least 1 reaction 👎.

user Total merged PRs Agreed / Disagreed / Total discussions conducted Comments conducted PR size: xs/s/m/l/xl Changes requested / Commented / Approved
dev1 22 0 / 0 / 0 0 5/2/0/1/0 0 / 0 / 8
dev2 13 3 / 2 / 22 33 10/3/4/0/3 5 / 8 / 20
dev3 2 0 / 0 / 2 3 4/2/1/2/1 1 / 1 / 10
dev4 8 0 / 0 / 0 0 6/2/1/0/0 0 / 0 / 9
dev5 2 0 / 0 / 1 1 2/0/0/0/0 0 / 1 / 2
total 47 3 / 2 / 25 37 30/9/6/2/3 6 / 12 / 46

Pull requests timeline(percentile75) total

Time to review - time from PR creation to first review.

Time to approve - time from PR creation to first approval without requested changes.

Time to merge - time from PR creation to merge.

user Time to review Time to approve Time to merge Total merged PRs
dev1 3 hours 34 minutes 7 hours 32 minutes 14 hours 9 minutes 22
dev2 4 hours 4 hours 23 hours 1 minute 13
dev3 15 hours 16 minutes 24 hours 7 minutes 53 hours 43 minutes 2
dev4 2 hours 41 minutes 9 hours 15 minutes 47 hours 41 minutes 8
dev5 5 hours 59 minutes 18 hours 55 minutes 40 hours 7 minutes 2
total 4 hours 21 minutes 7 hours 36 minutes 26 hours 14 minutes 47
gantt
title Pull requests timeline(percentile75) total / minutes
dateFormat X
axisFormat %s
section dev1
                Time to review(3 hours 34 minutes) :  0, 214
Time to approve(7 hours 32 minutes) :  0, 452
Time to merge(14 hours 9 minutes) :  0, 849

section dev2
                Time to review(4 hours) :  0, 240
Time to approve(4 hours) :  0, 240
Time to merge(23 hours 1 minute) :  0, 1381

section dev3
                Time to review(15 hours 16 minutes) :  0, 916
Time to approve(24 hours 7 minutes) :  0, 1447
Time to merge(53 hours 43 minutes) :  0, 3223

section dev4
                Time to review(2 hours 41 minutes) :  0, 161
Time to approve(9 hours 15 minutes) :  0, 555
Time to merge(47 hours 41 minutes) :  0, 2861

section dev5
                Time to review(5 hours 59 minutes) :  0, 359
Time to approve(18 hours 55 minutes) :  0, 1135
Time to merge(40 hours 7 minutes) :  0, 2407

section total
                Time to review(4 hours 21 minutes) :  0, 261
Time to approve(7 hours 36 minutes) :  0, 456
Time to merge(26 hours 14 minutes) :  0, 1574

longest-pending reviews

  1. Feature: PR Title(example) (7 hours 26 minutes)
  2. Feature: PR Title(example) (7 hours 20 minutes)
  3. Feature: PR Title(example) (7 hours 10 minutes)

longest-pending approvals

  1. Feature: PR Title(example) (2 hours 15 minutes)
  2. Feature: PR Title(example) (2 hours 7 minutes)
  3. Feature: PR Title(example) (2 hours 3 minutes)

longest-pending merge

  1. Feature: PR Title(example) (2 hours 33 minutes)
  2. Feature: PR Title(example) (2 hours 30 minutes)
  3. Feature: PR Title(example) (2 hours 12 minutes)

Workload stats total

Reviews conducted - number of reviews conducted. 1 PR may have only single review.

PR Size - determined using the formula: additions + deletions * 0.5. Based on this calculation: 0-50: xs, 51-200: s, 201-400: m, 401-700: l, 701+: xl

user Total opened PRs Total merged PRs Additions/Deletions PR size: xs/s/m/l/xl Total comments Reviews conducted
dev1 24 22 +1448/-3110 14/5/4/0/1 41 8
dev2 14 13 +813/-2062 7/4/1/2/0 6 20
dev3 2 2 +15/-3 2/0/0/0/0 1 10
dev4 8 8 +5416/-4600 6/0/1/0/1 7 9
dev5 2 2 +838/-362 1/0/0/0/1 16 2
total 50 47 +8530/-10137 30/9/6/2/3 71 46

Pull request quality total

Agreed - discussions with at least 1 reaction 👍.

Disagreed - discussions with at least 1 reaction 👎.

user Total merged PRs Changes requested received Agreed / Disagreed / Total discussions received Comments received
dev1 22 3 0 / 0 / 10 20
dev2 13 1 0 / 0 / 2 3
dev3 2 0 0 / 0 / 1 1
dev4 8 1 0 / 0 / 4 4
dev5 2 1 3 / 2 / 8 9
total 47 6 3 / 2 / 25 37

The most commented PRs

  1. Feature: PR Title(example)(18)
  2. Feature: PR Title(example)(16)
  3. Feature: PR Title(example)(15)

Code review engagement total

PR Size - determined using the formula: additions + deletions * 0.5. Based on this calculation: 0-50: xs, 51-200: s, 201-400: m, 401-700: l, 701+: xl

Changes requested / Comments / Approvals - number of reviews conducted by user. For a single pull request, only one review of each status will be counted for a user.

Agreed - discussions with at least 1 reaction 👍.

Disagreed - discussions with at least 1 reaction 👎.

user Total merged PRs Agreed / Disagreed / Total discussions conducted Comments conducted PR size: xs/s/m/l/xl Changes requested / Commented / Approved
dev1 22 0 / 0 / 0 0 5/2/0/1/0 0 / 0 / 8
dev2 13 3 / 2 / 22 33 10/3/4/0/3 5 / 8 / 20
dev3 2 0 / 0 / 2 3 4/2/1/2/1 1 / 1 / 10
dev4 8 0 / 0 / 0 0 6/2/1/0/0 0 / 0 / 9
dev5 2 0 / 0 / 1 1 2/0/0/0/0 0 / 1 / 2
total 47 3 / 2 / 25 37 30/9/6/2/3 6 / 12 / 46