Mohammed Nafees 3 лет назад
Родитель
Сommit
593465df40
1 измененных файлов с 3 добавлено и 3 удалено
  1. 3 3
      api/server/handlers/webhook/github_incoming.go

+ 3 - 3
api/server/handlers/webhook/github_incoming.go

@@ -212,11 +212,11 @@ func (c *GithubIncomingWebhookHandler) processPullRequestEvent(event *github.Pul
 					if err == nil {
 						fmt.Printf("workflow runs for status - %s, count - %d\n", status, runs.GetTotalCount())
 
-						for _, run := range runs.WorkflowRuns {
-							_, err := client.Actions.CancelWorkflowRunByID(reqCtx, owner, repo, run.GetID())
+						for idx := 0; idx < runs.GetTotalCount(); idx += 1 {
+							_, err := client.Actions.CancelWorkflowRunByID(reqCtx, owner, repo, runs.WorkflowRuns[idx].GetID())
 
 							if err != nil {
-								errChan <- fmt.Errorf("error cancelling %s: %w", run.GetHTMLURL(), err)
+								errChan <- fmt.Errorf("error cancelling %s: %w", runs.WorkflowRuns[idx].GetHTMLURL(), err)
 							}
 						}
 					} else {