This tool was created to have a rough estimate of how long it took PRs to go from Ready for Review until a Merged state for a given time period. At some point it would be nice to graph this data and compare it to DevEx changes.
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtFollow the instructions located here to install and setup the Github CLI. This will give the script everything your user has access to, however, this script only queries PR/issue data.
Modify the config for data you would like to see. Keep it small for the first lookup.
python pr_data.pyThe tqdm output shows progress, how long it took to run (5 seconds below), and how many iterations per second were accomplished.
100%|████████████████████████████████████████████████████████████████| 14/14 [00:05<00:00, 2.46it/s]
department-of-veterans-affairs/notification-api 2025-04-01..2025-04-15 Total PRs: 10
department-of-veterans-affairs/notification-api 2025-04-01..2025-04-15 Total minutes: 5080
department-of-veterans-affairs/notification-api 2025-04-01..2025-04-15 Average minutes: 508
department-of-veterans-affairs/notification-api 2025-04-01..2025-04-15 Median minutes: 62
There were 14 PRs merged in the date range but only 10 were drafts turned ready for review, had the correct number of approvals, and a merge. The 4 may have been closed, pushed through by an admin, or a bot that can automerge if the checks pass.
This was implemented with both shell scripts that used the gh CLI and an all python implementation. The python implementation, using PyGithub, was about 5x slower and required generation of a PAT. Data between the two was slightly different as well, probably due to the python package using Github's REST API and the gh cli using GraphQL API.