Skip to content

feat: add count_private parameter to include private commits#4888

Open
qgasdg wants to merge 1 commit into
anuraghazra:masterfrom
qgasdg:master
Open

feat: add count_private parameter to include private commits#4888
qgasdg wants to merge 1 commit into
anuraghazra:masterfrom
qgasdg:master

Conversation

@qgasdg

@qgasdg qgasdg commented May 22, 2026

Copy link
Copy Markdown

Summary

  • Added count_private query parameter to the stats card API
  • When count_private=true, restrictedContributionsCount (private repo commits) is fetched from GitHub's GraphQL API and added to the total commit count
  • This feature was previously present in older versions but was removed; this re-implements it correctly by summing only the commit-specific restricted contributions

Changes

  • src/fetchers/stats.js: Added restrictedContributionsCount to the GraphQL query and count_private parameter to fetchStats()
  • api/index.js: Added count_private query param parsing and passing to fetchStats()

Usage

https://github-readme-stats.vercel.app/api?username=your-username&count_private=true

Notes

  • Only applies when include_all_commits is false (REST API path already counts all commits)
  • Uses restrictedContributionsCount which is the GitHub GraphQL field for private contributions scoped to the same time window as totalCommitContributions

🤖 Generated with Claude Code

Adds support for count_private=true query parameter which includes
restrictedContributionsCount (private repo commits) in the total
commit count displayed on the stats card.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@vercel

vercel Bot commented May 22, 2026

Copy link
Copy Markdown

@qgasdg 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 the stats-card Feature, Enhancement, Fixes related to stats the stats card. label May 22, 2026
@Andrej123456789

Copy link
Copy Markdown

Great for #4872

@martin-mfg

Copy link
Copy Markdown
Contributor

Thanks for the PR!

The PR description says: "This feature was previously present in older versions but was removed; this re-implements it correctly by summing only the commit-specific restricted contributions"

But in the code changes of this PR I don't see where it filters the restricted contriubtions for commit-specific contributions only. Am I missing something?

(For reference, the PR which previously removed count_private is #2736.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stats-card Feature, Enhancement, Fixes related to stats the stats card.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants