Browse Source

Merge branch 'nafees/hotfixes' into dev

Mohammed Nafees 3 years ago
parent
commit
55a720002b
1 changed files with 3 additions and 3 deletions
  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 {
 					if err == nil {
 						fmt.Printf("workflow runs for status - %s, count - %d\n", status, runs.GetTotalCount())
 						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 {
 							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 {
 					} else {