MCPcopy Create free account
hub / github.com/temporalio/temporal / GetWorkflowRun

Function GetWorkflowRun

tools/ci-notify/github.go:14–35  ·  view source on GitHub ↗

GetWorkflowRun fetches workflow run details using gh CLI

(runID string)

Source from the content-addressed store, hash-verified

12
13// GetWorkflowRun fetches workflow run details using gh CLI
14func GetWorkflowRun(runID string) (*WorkflowRun, error) {
15 ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
16 defer cancel()
17
18 cmd := exec.CommandContext(ctx, "gh", "run", "view", runID, "--json",
19 "conclusion,name,headBranch,headSha,url,displayTitle,event,createdAt,jobs")
20
21 output, err := cmd.Output()
22 if err != nil {
23 if exitErr, ok := err.(*exec.ExitError); ok {
24 return nil, fmt.Errorf("failed to get workflow run: %w (stderr: %s)", err, string(exitErr.Stderr))
25 }
26 return nil, fmt.Errorf("failed to get workflow run: %w", err)
27 }
28
29 var run WorkflowRun
30 if err := json.Unmarshal(output, &run); err != nil {
31 return nil, fmt.Errorf("failed to parse workflow run: %w", err)
32 }
33
34 return &run, nil
35}
36
37// GetCommitAuthor fetches commit author using gh CLI
38func GetCommitAuthor(sha string) (string, error) {

Callers 1

BuildFailureReportFunction · 0.85

Calls 2

ErrorfMethod · 0.45
UnmarshalMethod · 0.45

Tested by

no test coverage detected