Add issues and pull request counter to pin card
Closes the #2486
@guibranco is attempting to deploy a commit to the github readme stats Team on Vercel.
A member of the Team first needs to authorize it.
Great pull request! 🔥I will look at it later. There are, however, two things that still need to be added:
- [x] The new options need to be added to the documentation -> https://github.com/anuraghazra/github-readme-stats#repo-card-exclusive-options.
- [x] Tests need to be added for the new options in: https://github.com/anuraghazra/github-readme-stats/blob/112000667c01f18fd161f204ae3ee796ec2e3011/tests/renderRepoCard.test.js#L45-L52
The issues count and pull requests count are not an option, they are fixed. Do you prefer to add as optional ?
If the answer for the previous question is yes should I also add options to stargazers and forks ?
The issues count and pull requests count are not an option, they are fixed. Do you prefer to add as optional ?
Given that these cards are based on GitHub's original pins, and these don't have these stats I think making them optional makes more sense. 👍

If the answer to the previous question is
yes, should I add options tostargazersandforks?
Forks and stargazers are on the original pin. So they can stay enabled by default but you can give people the option to disable them. 👍 @anuraghazra What do you think?
Sure, I'll work on it!
@rickstaa doc updated and also added the options to tests
@Zo-Bro-23 what do you think?
Thanks a lot for the PR! Most of it looks good to me. I'm not very familiar with SVG, however, so could you please include a screenshot or a live image to show me how it looks? Could you also please share the URL of a Vercel instance with the updated code so that I can test a few things out before merging? Thanks!
@Zo-Bro-23
Default:
All options enabled:
Hide stars and forks, and show issues and pull requests:
You can check a live deployed version of this PR here: https://github-readme-stats-guibranco.vercel.app/api/pin/
@Zo-Bro-23 you can merge this if you want. LGTM 👍🏻.
This is a really high quality PR 🎉 Thanks a lot for the contribution 🫂
A few more things before we merge:
- [ ] Variable name - Use
show_prsinstead ofshow_pull_requests? Internally, we usetotalPRsfor total pull requests, so this will fit in nicely with that. Thoughts? Obviously I'm being very nitpicky here, but it's better to have some system than just use random variable names, since other PRs like #2409 add new variables/options too. This is highly optional for merge. - [x] Card width was something I was worried about, but you seemed to have handled that excellently! Not only will the card never overflow (because width is fixed for repo cards), but you also seem to have added measureText checks for card width!
- [ ] Zero stars/prs/issues/forks - Since you can know specify whether or not to show stars, forks, etc, can we change the zero handling? What do you think? Initially you couldn't choose whether or not to show stars and forks, so they would be hidden if they were zero. But now you can hide them by default if zero, but can you please add logic that shows the stars and forks (even if zero) when the show_stars and show_forks options are specified as true? This may be hard to implement, so don't fret yourself up about it. It's just something that crossed my mind.
Here's one way you can do this:
show_stars,
show_forks,
show_issues,
show_pull_requests,
(remove default value)
const iconWithLabel = (icon, label, testid, show) => {
if (label <= 0 && (show == undefined || !show)) return "";
(don't hide if a user has specified true, but hide if user has not specified anything)
...((show_stars == undefined || show_stars) ? [svgStars] : []),
...((show_forks == undefined || show_forks) ? [svgForks] : []),
...(show_issues ? [svgIssues] : []),
...(show_pull_requests ? [svgPullRequests] : []),
(and the same for the measureText code)
- [ ] #2409. I still have some hope left that it'll be merged, in which case we need to add issue and pr icons (with custom text of course). Let me know if you would like to take this up. If not, I'll do it by myself when I get some time, perhaps after it gets merged.
Thanks again! Let me know what you think about the notes above.
PS: The cards look absolutely gorgeous; I just wanted to clear a few things up before merging!
Hi @guibranco, would you be able to make the requested changes? If not, I can perhaps do those changes myself, or merge without them (they're not very high-priority). Let me know if you're willing to work on those!
I can do it, but this week I'm out vacationing, maybe next week, WDYT ?
I can do it, but this week I'm out vacationing, maybe next week, WDYT ?
No problem; just wanted to know if you were planning to do it. Feel free to take your time; this is an OS project after all 🦄
@guibranco this is a great PR. Do you want me to merge it as is? It's fine if you're planning to work on it and incorporate the changes I suggested, but merging now is fine too if you don't want to spend too much time on this. I can incorporate those changes myself too. Let me know what you think!
@guibranco this is a great PR. Do you want me to merge it as is? It's fine if you're planning to work on it and incorporate the changes I suggested, but merging now is fine too if you don't want to spend too much time on this. I can incorporate those changes myself too. Let me know what you think!
@Zo-Bro-23 I agree with your suggestions. If you or @guibranco apply them I am happy to review this PR again. 👍🏻
You can merge now and then I can submit a new PR with the other changes, I'm still on vacation, sorry guys
You can merge now and then I can submit a new PR with the other changes, I'm still on vacation, sorry guys
There is no hurry in open source 🌈. Enjoy your holiday. @Zo-Bro-23 if you want it merged earlier feel free to commit changes and I will review. 👍🏻
I'll work on this PR this week guys!
@guibranco, did something go wrong while rebasing this pull request 🤔? I still think it's a nice feature to have 👍🏻.
@rickstaa I needed to sync the repository and had to discard the commits I had made. I will update now and open a new PR.