Skip to content

Commit 1ce5e9c

Browse files
committed
list all workflow jobs
1 parent 21ea7c1 commit 1ce5e9c

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

backend/utils/github.go

+7-4
Original file line numberDiff line numberDiff line change
@@ -149,15 +149,18 @@ func GetWorkflowIdAndUrlFromDiggerJobId(client *github.Client, repoOwner string,
149149
}
150150

151151
for _, workflowRun := range runs.WorkflowRuns {
152-
jobs, _, err := client.Actions.ListWorkflowJobs(context.Background(), repoOwner, repoName, *workflowRun.ID, nil)
152+
workflowjobs, _, err := client.Actions.ListWorkflowJobs(context.Background(), repoOwner, repoName, *workflowRun.ID, nil)
153153
if err != nil {
154154
return 0, "#", fmt.Errorf("error listing workflow jobs for run %v %v", workflowRun.ID, err)
155155
}
156156

157-
for _, step := range jobs.Jobs[0].Steps {
158-
if strings.Contains(*step.Name, job.DiggerJobID) {
159-
return *workflowRun.ID, fmt.Sprintf("https://github.com/%v/%v/actions/runs/%v", repoOwner, repoName, *workflowRun.ID), nil
157+
for _, workflowjob := range workflowjobs.Jobs {
158+
for _, step := range workflowjob.Steps {
159+
if strings.Contains(*step.Name, job.DiggerJobID) {
160+
return *workflowRun.ID, fmt.Sprintf("https://github.com/%v/%v/actions/runs/%v", repoOwner, repoName, *workflowRun.ID), nil
161+
}
160162
}
163+
161164
}
162165
}
163166

0 commit comments

Comments
 (0)