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.
open
/ closed
/ merged
/user/<username>
?response_type=json
to consume the json response directly?response_type=iframe
to embed the response in an iframeFetch 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.
go get github.com/karanjthakkar/showmyprs.com
go build && ./showmyprs.com
(This requires the GITHUB_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 βΊοΈ
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 via scp
.MIT Β© Karan Thakkar