@@ -15,11 +15,14 @@ import (
1515// Uses library functions from pkg/github and pkg/cost for fetching, sampling,
1616// and extrapolation - all functionality is available to external clients.
1717func analyzeRepository (ctx context.Context , owner , repo string , sampleSize , days int , cfg cost.Config , token , dataSource string ) error {
18+ // Create GitHub client without caching (for CLI)
19+ client := github .NewClientWithoutCache ()
20+
1821 // Calculate since date
1922 since := time .Now ().AddDate (0 , 0 , - days )
2023
2124 // Fetch all PRs modified since the date using library function
22- prs , _ , err := github .FetchPRsFromRepo (ctx , owner , repo , since , token , nil )
25+ prs , err := client .FetchPRsFromRepo (ctx , owner , repo , since , token , nil )
2326 if err != nil {
2427 return fmt .Errorf ("failed to fetch PRs: %w" , err )
2528 }
@@ -93,7 +96,7 @@ func analyzeRepository(ctx context.Context, owner, repo string, sampleSize, days
9396 totalAuthors := github .CountUniqueAuthors (prs )
9497
9598 // Query for actual count of open PRs (not extrapolated from samples)
96- openPRCount , err := github .CountOpenPRsInRepo (ctx , owner , repo , token )
99+ openPRCount , err := client .CountOpenPRsInRepo (ctx , owner , repo , token )
97100 if err != nil {
98101 slog .Warn ("Failed to count open PRs, using 0" , "error" , err )
99102 openPRCount = 0
@@ -128,13 +131,16 @@ func analyzeRepository(ctx context.Context, owner, repo string, sampleSize, days
128131// Uses library functions from pkg/github and pkg/cost for fetching, sampling,
129132// and extrapolation - all functionality is available to external clients.
130133func analyzeOrganization (ctx context.Context , org string , sampleSize , days int , cfg cost.Config , token , dataSource string ) error {
134+ // Create GitHub client without caching (for CLI)
135+ client := github .NewClientWithoutCache ()
136+
131137 slog .Info ("Fetching PR list from organization" )
132138
133139 // Calculate since date
134140 since := time .Now ().AddDate (0 , 0 , - days )
135141
136142 // Fetch all PRs across the org modified since the date using library function
137- prs , _ , err := github .FetchPRsFromOrg (ctx , org , since , token , nil )
143+ prs , err := client .FetchPRsFromOrg (ctx , org , since , token , nil )
138144 if err != nil {
139145 return fmt .Errorf ("failed to fetch PRs: %w" , err )
140146 }
@@ -208,7 +214,7 @@ func analyzeOrganization(ctx context.Context, org string, sampleSize, days int,
208214 totalAuthors := github .CountUniqueAuthors (prs )
209215
210216 // Count open PRs across the entire organization with a single query
211- totalOpenPRs , err := github .CountOpenPRsInOrg (ctx , org , token )
217+ totalOpenPRs , err := client .CountOpenPRsInOrg (ctx , org , token )
212218 if err != nil {
213219 slog .Warn ("Failed to count open PRs in organization, using 0" , "error" , err )
214220 totalOpenPRs = 0
0 commit comments