mirror of
https://github.com/tiennm99/ghstats.git
synced 2026-09-02 00:19:35 +00:00
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:
@@ -14,9 +14,12 @@ type Profile struct {
|
||||
Website string
|
||||
CreatedAt time.Time
|
||||
|
||||
Followers int
|
||||
Following int
|
||||
PublicRepos int
|
||||
Followers int
|
||||
Following int
|
||||
// RepoCount is how many repos survived the fetch filters, so it tracks
|
||||
// -include-forks / -include-private / -include-org-repos rather than
|
||||
// GitHub's public-only publicRepos count.
|
||||
RepoCount int
|
||||
|
||||
// Totals for the stats card.
|
||||
TotalStars int
|
||||
@@ -132,12 +135,15 @@ type LangEdge struct {
|
||||
// repoNode is the GraphQL shape of one repository node; kept here because
|
||||
// it's shared by the profile fetcher and the productive-time fetcher.
|
||||
type repoNode struct {
|
||||
Name string `json:"name"`
|
||||
IsPrivate bool `json:"isPrivate"`
|
||||
IsFork bool `json:"isFork"`
|
||||
StargazerCount int `json:"stargazerCount"`
|
||||
ForkCount int `json:"forkCount"`
|
||||
Owner *struct {
|
||||
Name string `json:"name"`
|
||||
IsPrivate bool `json:"isPrivate"`
|
||||
IsFork bool `json:"isFork"`
|
||||
StargazerCount int `json:"stargazerCount"`
|
||||
ForkCount int `json:"forkCount"`
|
||||
// ViewerPermission is only requested by profileQuery, where it separates
|
||||
// org repos the user administers from ones they merely have access to.
|
||||
ViewerPermission string `json:"viewerPermission"`
|
||||
Owner *struct {
|
||||
Login string `json:"login"`
|
||||
} `json:"owner"`
|
||||
PrimaryLanguage *struct {
|
||||
|
||||
Reference in New Issue
Block a user