Show My PR's
Motivation π°
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.
Features π
π»π₯
- Show the actual status of each pull request:
open/closed/merged - All your Pull Requests grouped by repositories:
/user/<username> - Add
?response_type=jsonto consume the json response directly - Add
?response_type=iframeto embed the response in an iframe
Implementation notes ππ»
- Fetch all the pull requests from the github
search/issuesendpoint
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
closedeven 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.
Coming Next π₯ (Want to help? ππ»)
- 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)
Known Issues π©
- Maximum limit of 1000 on the total pull requests sent (Issue #10)
Contributing π―
- 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_TOKENenvironment 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
Deploying π
- 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.
License
MIT Β© Karan Thakkar