@@ -618,8 +618,8 @@ func (s *githubRunnerScaler) getWorkflowRunJobs(ctx context.Context, workflowRun
618
618
}
619
619
620
620
// getWorkflowRuns returns a list of workflow runs for a given repository
621
- func (s * githubRunnerScaler ) getWorkflowRuns (ctx context.Context , repoName string ) (* WorkflowRuns , error ) {
622
- url := fmt .Sprintf ("%s/repos/%s/%s/actions/runs" , s .metadata .githubAPIURL , s .metadata .owner , repoName )
621
+ func (s * githubRunnerScaler ) getWorkflowRuns (ctx context.Context , repoName string , status string ) (* WorkflowRuns , error ) {
622
+ url := fmt .Sprintf ("%s/repos/%s/%s/actions/runs?status=%s " , s .metadata .githubAPIURL , s .metadata .owner , repoName , status )
623
623
body , statusCode , err := getGithubRequest (ctx , url , s .metadata , s .httpClient )
624
624
if err != nil && statusCode == 404 {
625
625
return nil , nil
@@ -672,12 +672,19 @@ func (s *githubRunnerScaler) GetWorkflowQueueLength(ctx context.Context) (int64,
672
672
var allWfrs []WorkflowRuns
673
673
674
674
for _ , repo := range repos {
675
- wfrs , err := s .getWorkflowRuns (ctx , repo )
675
+ wfrsQueued , err := s .getWorkflowRuns (ctx , repo , "queued" )
676
676
if err != nil {
677
677
return - 1 , err
678
678
}
679
- if wfrs != nil {
680
- allWfrs = append (allWfrs , * wfrs )
679
+ if wfrsQueued != nil {
680
+ allWfrs = append (allWfrs , * wfrsQueued )
681
+ }
682
+ wfrsInProgress , err := s .getWorkflowRuns (ctx , repo , "in_progress" )
683
+ if err != nil {
684
+ return - 1 , err
685
+ }
686
+ if wfrsInProgress != nil {
687
+ allWfrs = append (allWfrs , * wfrsInProgress )
681
688
}
682
689
}
683
690
0 commit comments