A couple of weeks ago I wrote an article about how GitHub should fix their pull request interface. My biggest annoyance was that it’s not possible to retrieve who’s assigned to a pull request from the (otherwise excellent) GitHub API. This was frustrating, because we want to display that information on our custom-build dashboard to track the progress of our issues and projects (a successor to our kanban board for CodebaseHQ). Luckily, I’ve now found a way.
Pull requests are just issues!
On GitHub, pull requests basically are just issues with code attached to them. This means you can fetch information like who’s assigned to a pull request by fetching it through the issue endpoint of their API, e.g.
GET /repos/my_user/my_repo/issues/1. The IDs for issues that are pull requests can be retrieved from the regular pull request endpoint. I wrote a little ruby script to see how well this would work, and it turned out to be exactly what I needed.
The one obvious drawback to this method is that you need to send a request to the GitHub API for each pull request you want to retrieve. When displaying a single pull request this is not too bad, but our dashboard shows a lot of pull requests (open ones and the ones closed in the last 30 days) which will lead to a significant longer load time for the dashboard. So for now, this is a nice workaround, but in the long run GitHub better fix their pull requests.
Want to work at the biggest learning source in the world?