@@ -177,7 +177,7 @@ func (client *Client) GetWorkflowUsage(ctx context.Context, owner, repo, workflo
177177 }
178178 var workflowRuns []* googlegithub.WorkflowRun
179179 var err error
180- workflowRuns , page , err = client .getWorkflowRuns (ctx , owner , repo , workflow , timeRange , page )
180+ workflowRuns , page , err = client .getWorkflowRuns (ctx , owner , repo , workflow , "" , timeRange , page )
181181 if err != nil {
182182 return models.WorkflowUsage {}, fmt .Errorf ("fetching workflow runs: %w" , err )
183183 }
@@ -280,7 +280,29 @@ func (client *Client) getWorkflowUsage(ctx context.Context, owner, repo string,
280280 return client .restClient .Actions .GetWorkflowUsageByFileName (ctx , owner , repo , workflow )
281281}
282282
283- func (client * Client ) getWorkflowRuns (ctx context.Context , owner , repo , workflow string , timeRange backend.TimeRange , page int ) ([]* googlegithub.WorkflowRun , int , error ) {
283+ func (client * Client ) GetWorkflowRuns (ctx context.Context , owner , repo , workflow string , branch string , timeRange backend.TimeRange ) ([]* googlegithub.WorkflowRun , error ) {
284+ workflowRuns := []* googlegithub.WorkflowRun {}
285+
286+ page := 1
287+ for {
288+ if page == 0 {
289+ break
290+ }
291+
292+ workflowRunsPage , nextPage , err := client .getWorkflowRuns (ctx , owner , repo , workflow , branch , timeRange , page )
293+ if err != nil {
294+ return nil , fmt .Errorf ("fetching workflow runs: %w" , err )
295+ }
296+
297+ workflowRuns = append (workflowRuns , workflowRunsPage ... )
298+
299+ page = nextPage
300+ }
301+
302+ return workflowRuns , nil
303+ }
304+
305+ func (client * Client ) getWorkflowRuns (ctx context.Context , owner , repo , workflow string , branch string , timeRange backend.TimeRange , page int ) ([]* googlegithub.WorkflowRun , int , error ) {
284306 workflowID , _ := strconv .ParseInt (workflow , 10 , 64 )
285307
286308 workflowRuns := []* googlegithub.WorkflowRun {}
@@ -298,11 +320,13 @@ func (client *Client) getWorkflowRuns(ctx context.Context, owner, repo, workflow
298320 runs , response , err = client .restClient .Actions .ListWorkflowRunsByID (ctx , owner , repo , workflowID , & googlegithub.ListWorkflowRunsOptions {
299321 Created : created ,
300322 ListOptions : googlegithub.ListOptions {Page : page , PerPage : 100 },
323+ Branch : branch ,
301324 })
302325 } else {
303326 runs , response , err = client .restClient .Actions .ListWorkflowRunsByFileName (ctx , owner , repo , workflow , & googlegithub.ListWorkflowRunsOptions {
304327 Created : created ,
305328 ListOptions : googlegithub.ListOptions {Page : page , PerPage : 100 },
329+ Branch : branch ,
306330 })
307331 }
308332
0 commit comments