MCPcopy Create free account
hub / github.com/github/gh-aw / fetchWorkflowRunMetadata

Function fetchWorkflowRunMetadata

pkg/cli/audit.go:1144–1162  ·  view source on GitHub ↗

fetchWorkflowRunMetadata fetches metadata for a single workflow run

(ctx context.Context, runID int64, owner, repo, hostname string, verbose bool)

Source from the content-addressed store, hash-verified

1142
1143// fetchWorkflowRunMetadata fetches metadata for a single workflow run
1144func fetchWorkflowRunMetadata(ctx context.Context, runID int64, owner, repo, hostname string, verbose bool) (WorkflowRun, error) {
1145 args := buildWorkflowRunMetadataArgs(runID, owner, repo, hostname)
1146 if verbose {
1147 fmt.Fprintln(os.Stderr, console.FormatInfoMessage("Executing: gh "+strings.Join(args, " ")))
1148 }
1149 output, err := workflow.RunGHCombinedContext(ctx, "Fetching run metadata...", args...)
1150 if err != nil {
1151 if verbose {
1152 fmt.Fprintln(os.Stderr, console.FormatVerboseMessage(string(output)))
1153 }
1154 return WorkflowRun{}, classifyWorkflowRunMetadataError(runID, err, output)
1155 }
1156 var run WorkflowRun
1157 if err := json.Unmarshal(output, &run); err != nil {
1158 return WorkflowRun{}, fmt.Errorf("failed to parse run metadata: %w", err)
1159 }
1160 resolveWorkflowRunDisplayName(ctx, &run, owner, repo, hostname)
1161 return run, nil
1162}
1163
1164func buildWorkflowRunMetadataArgs(runID int64, owner, repo, hostname string) []string {
1165 endpoint := fmt.Sprintf("repos/{owner}/{repo}/actions/runs/%d", runID)

Callers 2

fetchAuditRunWithCacheFunction · 0.85

Calls 7

FormatInfoMessageFunction · 0.92
RunGHCombinedContextFunction · 0.92
FormatVerboseMessageFunction · 0.92
ErrorfMethod · 0.45

Tested by

no test coverage detected