From a7cdf119e95757dbb4794e69e06084fd3a569502 Mon Sep 17 00:00:00 2001 From: qgasdg Date: Fri, 22 May 2026 18:22:09 +0700 Subject: [PATCH] feat: add count_private parameter to include private commits 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 --- api/index.js | 2 ++ src/fetchers/stats.js | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/api/index.js b/api/index.js index 6ea4ffe0c20e7..2d477c337196a 100644 --- a/api/index.js +++ b/api/index.js @@ -28,6 +28,7 @@ export default async (req, res) => { hide_rank, show_icons, include_all_commits, + count_private, commits_year, line_height, title_color, @@ -94,6 +95,7 @@ export default async (req, res) => { showStats.includes("discussions_started"), showStats.includes("discussions_answered"), parseInt(commits_year, 10), + parseBoolean(count_private), ); const cacheSeconds = resolveCacheSeconds({ requested: parseInt(cache_seconds, 10), diff --git a/src/fetchers/stats.js b/src/fetchers/stats.js index 376a15816144e..1371702993ad9 100644 --- a/src/fetchers/stats.js +++ b/src/fetchers/stats.js @@ -45,6 +45,7 @@ const GRAPHQL_STATS_QUERY = ` login commits: contributionsCollection (from: $startTime) { totalCommitContributions, + restrictedContributionsCount, } reviews: contributionsCollection { totalPullRequestReviewContributions @@ -232,6 +233,7 @@ const fetchStats = async ( include_discussions = false, include_discussions_answers = false, commits_year, + count_private = false, ) => { if (!username) { throw new MissingParamError(["username"]); @@ -290,6 +292,9 @@ const fetchStats = async ( stats.totalCommits = await totalCommitsFetcher(username); } else { stats.totalCommits = user.commits.totalCommitContributions; + if (count_private) { + stats.totalCommits += user.commits.restrictedContributionsCount; + } } stats.totalPRs = user.pullRequests.totalCount;