5 PR Metrics on 303 Merged PRs from pytest and pydantic: 2 Point at Review Bottlenecks
Описание и применение
Скрипт на Python собирает метрики PR из репозиториев pytest и pydantic, чтобы определить, является ли ревью узким местом в процессе доставки изменений.
Задача
Determine if review is the slow part of shipping a change by analyzing PR metrics.
Результат
Script outputs 303 PR records with metrics such as first review time, merge time, approval-to-merge time, review comments, cycles, and changed lines for pytest and pydantic repositories.
Рабочий процесс
- 1. Set repository and date window (90 days).
- 2. Authenticate with GitHub API using GITHUB_TOKEN.
- 3. Retrieve closed PRs sorted by updated date.
- 4. Filter PRs merged within the window and exclude bots.
- 5. For each PR, collect author, creation and merge times, reviews, approvals, comments, cycles, and changed lines.
- 6. Calculate time to first review, total merge time, time from last approval to merge, and other metrics.
- 7. Append data to rows list.
- 8. Output rows as JSON file.
Доказательства
All numbers below come from the GitHub REST API, and you can rerun the script to check them.
The script produces JSON with metrics for 303 merged PRs from pytest and pydantic.
- Дата записи: 2026-10-22T14:11:26.467Z