Created
November 24, 2020 08:38
-
-
Save developer-guy/0d412a932cf0da6af770f7230d34f6ab to your computer and use it in GitHub Desktop.
Workflow Job's list
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"context" | |
"fmt" | |
"github.com/google/go-github/v32/github" | |
) | |
func main() { | |
client := github.NewClient(nil) | |
ctx := context.Background() | |
workflows, _, _ := client.Actions.ListWorkflows(ctx, "developer-guy", "ingress-operator",&github.ListOptions{}) | |
for _ , workflow := range workflows.Workflows { | |
fmt.Println("Workflow name: ", workflow.Name) | |
workflowRuns, _, _ := client.Actions.ListWorkflowRunsByID(ctx, "developer-guy", "ingress-operator", *workflow.ID, &github.ListWorkflowRunsOptions{}) | |
for _, workflowRun := range workflowRuns.WorkflowRuns { | |
fmt.Println("Workflow run status:", *workflowRun.Status) | |
workflowJobs, _ , _ := client.Actions.ListWorkflowJobs(ctx, "developer-guy", "ingress-operator", *workflowRun.ID, &github.ListWorkflowJobsOptions{}) | |
for _, job := range workflowJobs.Jobs { | |
fmt.Println("job name:", *job.Name) | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment