@@ -51,22 +51,13 @@ type githubCommitter struct {
51
51
Date time.Time `json:"date"`
52
52
}
53
53
54
- // getDiff calls the `compare` endpoint.
55
- func (c githubClient ) getDiff (base , head string ) (githubDiff , error ) {
56
- diff := githubDiff {}
57
- if err := c .runGHAPICommand (fmt .Sprintf ("repos/%s/compare/%s...%s?per_page=1'" , c .repo , base , head ), & diff ); err != nil {
58
- return githubDiff {}, err
59
- }
60
- return diff , nil
61
- }
62
-
63
54
// getDiffAllCommits calls the `compare` endpoint, iterating over all pages and aggregating results.
64
55
func (c githubClient ) getDiffAllCommits (base , head string ) (* githubDiff , error ) {
65
56
pageSize := 250
66
57
url := fmt .Sprintf ("repos/%s/compare/%s...%s" , c .repo , base , head )
67
58
68
- diff , commits , err := iterate (c , url , pageSize , nil , func (new * githubDiff ) ([]githubCommitNode , int ) {
69
- return new .Commits , new .Total
59
+ diff , commits , err := iterate (c , url , pageSize , nil , func (page * githubDiff ) ([]githubCommitNode , int ) {
60
+ return page .Commits , page .Total
70
61
})
71
62
if err != nil {
72
63
return nil , err
@@ -158,8 +149,8 @@ func (c githubClient) listMergedPRs(after, before time.Time, baseBranches ...str
158
149
searchQuery += "+base:" + strings .Join (baseBranches , "+base:" )
159
150
}
160
151
161
- _ , prs , err := iterate (c , "search/issues" , pageSize , []string {"q=" + searchQuery }, func (new * githubPRList ) ([]githubPR , int ) {
162
- return new .Items , new .Total
152
+ _ , prs , err := iterate (c , "search/issues" , pageSize , []string {"q=" + searchQuery }, func (page * githubPRList ) ([]githubPR , int ) {
153
+ return page .Items , page .Total
163
154
})
164
155
if err != nil {
165
156
return nil , err
@@ -179,7 +170,7 @@ func (c githubClient) runGHAPICommand(url string, response any) error {
179
170
return json .Unmarshal (out , response )
180
171
}
181
172
182
- type extractFunc [T , C any ] func (newPage * T ) (pageElements []C , totalElements int )
173
+ type extractFunc [T , C any ] func (page * T ) (pageElements []C , totalElements int )
183
174
184
175
func iterate [T , C any ](client githubClient , url string , pageSize int , extraQueryArgs []string , extract extractFunc [T , C ]) (* T , []C , error ) {
185
176
page := 0
0 commit comments