feat: count org repos and fix contribution-window truncation

Split each contribution year into quarterly windows.
commitContributionsByRepository caps at 100 repos per query and drops
the remainder without signalling it, which a prolific year hits: 2026
returned exactly 100 where the quarterly union returns 108. Warn when a
window still comes back at the ceiling instead of reporting a complete
list.

Add -include-org-repos / include_org_repos so org-owned repos the user
administers count toward stars, repo count, repos-per-language and
top-starred. Off by default, since enabling it moves those totals for
every existing caller. Commit-driven cards already covered org repos
through the seed list. Org repos carrying only read or write access are
dropped via viewerPermission.

Rename Profile.PublicRepos to RepoCount and drop "public" from the card
label: the count tracks the fetch filters and includes private repos
whenever the token can see them.
This commit is contained in:
tiennm99 committed 2026-08-13 13:20:41 +07:00
1 parent 4d7de90656
commit 30ba70d8ea
12 files changed
+294 -79

No files matched your search

+4 -2
View File
@@ -27,6 +27,7 @@ func main() {
perRepo = flag.Int("commits-per-repo", 500, "max commits sampled per repo (covers both last-year and all-time aggregates)")
includeForks = flag.Bool("include-forks", true, "include forked repos in stats and commit probing")
includePrivate = flag.Bool("include-private", true, "include private repos (requires PAT with repo scope; silently no-op otherwise)")
includeOrgs = flag.Bool("include-org-repos", false, "count org-owned repos you administer toward stars, repo count, repos-per-language and top-starred")
timeout = flag.Duration("timeout", 30*time.Minute, "overall deadline for fetch phase (0 = no limit)")
startOfWeek = flag.String("start-of-week", "sunday", "first day of week for heatmap rows and weekday bars (sunday|monday|tuesday|…)")
listThemes = flag.Bool("list-themes", false, "print available theme ids and exit")
@@ -65,8 +66,9 @@ func main() {
}
opts := github.FetchOptions{
IncludeForks: *includeForks,
IncludePrivate: *includePrivate,
IncludeForks: *includeForks,
IncludePrivate: *includePrivate,
IncludeOrgRepos: *includeOrgs,
}
// Overall fetch budget. Ctrl-C cancels in-flight HTTP requests cleanly.