How can I track how long pull requests have been open on GitHub?

Related searches

We use GitHub Enterprise for our internal code base. A common issue that we face across teams is the "pull-request review turnaround time" can sometimes be a few "physical days" (many ideal hours).

We're tweaking some engineering practices to prevent PRs from being unnecessarily large and allow for faster turnaround times on reviews. However, I couldn't find anything to help accurately track how long PRs were open before they were merged.

We'd like to use objective metrics to validate some of our approaches to see if we make meaningful differences to the review times and "open-PR duration till merging" is an important metric to track.

Does git/GitHub have anything that could help obtain such metrics? I tried looking but nothing shows up anywhere.

The graphQL API of GitHub could help you to get pull requests metadata such as when the PR has been created (createdAt) and when it have been merged (mergedAt) https://developer.github.com/v4/object/pullrequest/ You could search all pull request with the search query https://developer.github.com/v4/query/#connections then compute the time to merge.

Also you might be interested in this tool https://github.com/change-metrics/monocle as it provides Pull Request metrics for GitHub repositories. Among other various metrics the tools computes the "Mean time to merge" metrics. Thanks to the filters you could set, you could get the mean time to merge for the whole GitHub organization, a specific repository, or developer, or a group of developers.

Viewing all of your issues and pull requests, list the open issues and pull requests you've created. You can use them to update items that have gone stale, close them, or keep track of where you've been� Use pull requests. Pull requests are an excellent tool for fostering code review. If you’re using Github for team projects, you should be using these extensively. Many people don’t realise that you can make pull requests between two branches of the same repository (the so-called “shared repository model”). For team projects, this is

You can use the Github Rest Api to get the details. I have added an example with a sample repo. I think for enterprise editions you have to access the repo information using tokens (https://github.com/settings/tokens). In that case the request uri will be

https://api.github.com/repos/srajagop/page-test/pulls?token=xxxxxxxxxxxxxxxxx

for example

async function timeElapsed(){
   let response = await fetch('https://api.github.com/repos/srajagop/page-test/pulls');
   let jsonData = await response.json();
   let diff = new Date().getTime() - new Date(Date.parse('2019-04-26T05:56:33Z')).getTime();
   let hoursElapsed = Math.ceil(diff / (1000 * 60 * 60)); 
   return hoursElapsed;
}
timeElapsed().then(data => console.log("Hours elapsed", data)); 

rkclark/pullp: A Github pull request monitoring tool for Mac , An interactive dashboard shows all the open pull requests for your chosen repositories and highlights where your review has been requested. To help you keep track of things, Pullp has configurable desktop notifications to keep you in the� Once you're done fixing a bug or new feature in a branch, create a new pull request. Add the members of the team to the pull request so they can review and vote on your changes. Azure Repos has a rich pull request experience that's easy to use and scales to your needs. Use pull requests to review works in progress and get early feedback on changes.

There are also tools like Haystack that basically take some 'best practices' like this and send you alerts for things like concurrent work, idle pull requests, large pull requests, etc to help keep on top of it. Plus analytics to show how things like PR turnaround time are trending

Note: This is a paid service, not a build your own thing

About pull requests, Pull requests let you tell others about changes you've pushed to a branch in a repository on GitHub. Once a pull request is opened, you can discuss and review the potential changes Tracking the progress of your work with project boards within your pull request and the changes will be visible in the "Files changed" tab. Our teams use git hub issues to manage projects. We open issues for tasks and they get closed with a pull request. I have to open tabs for both the pull request and the issue to do code review. The conversation about the requirements and the implementation are split into two places. Hopefully, everyone remembers to add the magic words closes #NNN.

Pull Requests, Comments on pull requests can be managed via the Issue Comments API. Can be either created , updated , popularity (comment count) or long-running (age, " state": "open", "title": "v1.0", "description": "Tracking milestone for version 1.0", To open or update a pull request in a public repository, you must have write� It looks like the Pull Request doesn't keep track of changes to the target branch (I contacted GitHub support, and received a response on 18 Nov 2014 stating this is by design). However, you can get it to show you the updated changes by doing the following:

Searching issues and pull requests, You can search for issues and pull requests on GitHub and narrow the results Limiting interactions in your organization � Tracking changes in a comment You can filter issues and pull requests based on whether they're open or review: none, type:pr review:none matches pull requests that have not been reviewed. $ git pull-request --fork never You can set the option with git and use the command without any arguments: $ git config git-pull-request.fork never $ git pull-request You can also set the option globally to have a custom default for all your repositories with: $ git config --global git-pull-request.fork always $ git pull-request

Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported.

Comments
  • Monocle sounds neat - I should give it a shot. I guess it could also work for stash repos too, no?
  • @PhD From what I understand about stash, I guess no as monocle provide crawlers for GitHub and Gerrit only at the moment. It seems stash and bitbucket are the same, well that might be a good addition in monocle to add the bitbucket crawler.