Skip to content

show stats for specific organizations or repositories #4290

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 29 commits into
base: master
Choose a base branch
from

Conversation

martin-mfg
Copy link

This PR adds new functionality to show contribution stats for specific repositories and organizations.

GitHub Stats Card changes

Add optional parameters &repos=userA/repoA,orgB/repoB and &owners=userC,orgD to filter the user's contributions by repo or organization.

GitHub Extra Pins (Repo Card) changes

Add optional parameter &show=prs_authored,prs_commented,prs_reviewed,issues_authored,issues_commented to display the user's contribution to the pinned repository.

Supporting changes

  • Add 5 new options to show: prs_authored, prs_commented, prs_reviewed, issues_authored and issues_commented.

    They are similar to some existing options, e.g. issues_authored is similar to issues. The difference is how these values are fetched - via GraphQL or via REST API. The pre-existing items use GraphQL, but filtering by repository or owner works better via REST API.

  • Add some style options to GitHub Extra Pins (Repo Card) which existed already for GitHub Stats card: card_width, show_icons, line_height, text_bold, number_format and show. They only affect the style of the new options introduced in this PR.

  • update readme with new descriptions and examples

  • allow user-specified card_width parameter to be smaller than internally computed minimum width. If the user explicitly asks for a specific display width, there's no need to prevent this. Especially with the new stats options I found smaller widths helpful.

  • For GitHub Extra Pins (Repo Card), the repo parameter can now optionally include the repo owner. This is useful for showing user A's contributions to user B's repository.

  • Make the new individual stats clickable links. Links lead to the list of relevant contributions, e.g. a list of the user's created PRs (in a specific repository). However, GitHub turns the whole image into a link, so this feature isn't too useful. People have to click the image first, which opens it in a new tab, then in the new tab again click the specific stat that they are interested in. Alternatively, if the generated images are embedded on another site than GitHub, the new links are directly clickable.

  • minor adjustments of rendering logic to support new features, more informative error messages, etc.

Demo

anuraghazra's contributions to github-readme-stats:
anuraghazra's contributions to github-readme-stats

anurag's contributions to razorpay:
anurag's contributions to razorpay

A version of github-readme-stats including my changes is available here for testing.
A fork with my changes is available at https://github.com/martin-mfg/github-readme-stats/tree/readme-test. Feel free to fork and host your own version while this PR is being reviewed.

Motivation

As contributor in another Open Source project, I wanted to have an overview of my own contributions to that specific project. And I wanted to display this overview on my GitHub profile page. I think other Open Source contributors might find this useful too.

Copy link

vercel bot commented Jun 10, 2025

@martin-mfg is attempting to deploy a commit to the github readme stats Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions bot added documentation Improvements or additions to documentation. stats-card Feature, Enhancement, Fixes related to stats the stats card. repo-card Issues related to the pin/repo card. card-i18n Card text translations. labels Jun 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
card-i18n Card text translations. documentation Improvements or additions to documentation. repo-card Issues related to the pin/repo card. stats-card Feature, Enhancement, Fixes related to stats the stats card.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant