karanjthakkar / showmyprs.com

See all your Open Source contributions in one place
https://showmyprs.com
MIT License
30 stars 4 forks source link
contributions github open-source pull-requests

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 πŸ’…πŸ»πŸ’₯

  1. Show the actual status of each pull request: open / closed / merged
  2. All your Pull Requests grouped by repositories: /user/<username>
  3. Add ?response_type=json to consume the json response directly
  4. Add ?response_type=iframe to embed the response in an iframe

Implementation notes πŸ™‡πŸ»

  1. Fetch all the pull requests from the github search/issues endpoint

    https://api.github.com/search/issues?q=type:pr+author:gaearon+is:public

  2. 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.

  3. 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

  4. 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? πŸ‘‡πŸ»)

Known Issues πŸ’©

Contributing πŸ‘―

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 πŸš€

License

MIT Β© Karan Thakkar