I wanted to create an Open Source
section on my website to showcase some of the contributions that I have done over the years. Finding the PR's, sorting them, grouping them was a big pain. I couldnt't find any service that did this already.
- Show the actual status of each pull request:
open
/closed
/merged
- All your Pull Requests grouped by repositories:
/user/<username>
- Add
?response_type=json
to consume the json response directly - Add
?response_type=iframe
to embed the response in an iframe
- Fetch all the pull requests from the github
search/issues
endpoint
https://api.github.com/search/issues?q=type:pr+author:gaearon+is:public
- For each pull request, fetch the repository data (stars/forks)
https://api.github.com/repos/:owner/:repo
Note: The repository data is cached in-memory and is reused between subsequent calls.
- The search endpoint returns status as
closed
even for pull requests that have been merged. So, for each closed pull request, the merge status is fetched using the below endpoint.
https://api.github.com/repos/:owner/:repo/pulls/:number/merge
- These pull requests are then grouped based on the repository and then sent to the client.
NOTE: The final response is cached on the server per user in a file ./.cache/<username>
. For now, this will be manually purged by me every 24 hours automatically refreshed every 30 minutes using a cron job running via this bash script. Eventually, it should go into some cache like Redis which has its own TTL implementation.
- Sorting based on the stars/forks that a repository has (Issue #4)
- Sorting based on the number of PR's for a repository (Issue #4)
- Filters based on PR state: Open/Merged/Closed (Issue #3)
- Maximum limit of 1000 on the total pull requests sent (Issue #10)
- Make sure you have installed Go and setup your workspace
- Get the latest code:
go get github.com/karanjthakkar/showmyprs.com
- Start the server:
go build && ./showmyprs.com
(This requires theGITHUB_TOKEN
environment variable. Heres how you can get yours)
If you need help figuring out how to contribute (since its written in Go), hit me up on Twitter or Email. I would love to help you get set up
- Pre-requisite:
npm install
grunt build deploy
: This builds the binary for my Ubuntu linux instance on Amazon EC2 and uploads it along with the web assets viascp
.
MIT © Karan Thakkar