pujux / badge-it

An API serving useful badges for your GitHub Profile README 🚀🎉 Formerly known as git-badges.
http://pufler.dev/badge-it/
BSD 3-Clause "New" or "Revised" License
218 stars 24 forks source link

Feature: More on GitHub badge 🎉 #5

Closed thinkverse closed 4 years ago

thinkverse commented 4 years ago

I thought about creating a whole repo for this but remembered that @puf17640 had git-badges 🔥

Feature

Traveling to the endpoint years/:user returns an SVG with the number of years a user has been a member.

Usage

To use this feature, two environmental variables need to be added GITHUB_ID and GITHUB_TOKEN. Since we aren't hitting the GitHub API with OAuth we're using personal tokens to up the rate limit.

GITHUB_ID=username
GITHUB_TOKEN=personal_token

Enhancements

Enhancements that could be made are caching the result from the GitHub API to limit the number of requests being made, the current rate limit is 5000 requests per hour thanks to the Basic Auth - more info available on the GitHub Docs, might be good for the time being though. 🤔


Any feedback is much appreciated, and any help with the code would be awesome. 😀 👍

thinkverse commented 4 years ago

@puf17640 Actually removing date-fns and using your method doesn't show the correct year, it shows the difference between the calendar year, not the year between the two dates, my year badge should say 7 and I get 8.

pujux commented 4 years ago

@puf17640 Actually removing date-fns and using your method doesn't show the correct year, it shows the difference between the calendar year, not the year between the two dates, my year badge should say 7 and I get 8.

Good point, didn't think too much about it, I was about to try out if there are differences in having date-fns or not, will add it back in now! You also gave me the idea to have a few other badges that show profile info, will add them in right now too!

pujux commented 4 years ago

/repos/:user now returns the count of public repos

thinkverse commented 4 years ago

Please don't force push, it's causing merge conflicts. 👍

pujux commented 4 years ago

Please don't force push, it's causing merge conflicts. 👍

I forced push over your readability/whitespace commit as I already ran lint:fix which fixed the whitespaces and I don't think newlines are needed since readability is pretty okay imo