MCPcopy
hub / github.com/github/github-mcp-server / getWorkflowRunUsage

Function getWorkflowRunUsage

pkg/github/actions.go:1003–1016  ·  view source on GitHub ↗
(ctx context.Context, client *github.Client, owner, repo string, resourceID int64)

Source from the content-addressed store, hash-verified

1001}
1002
1003func getWorkflowRunUsage(ctx context.Context, client *github.Client, owner, repo string, resourceID int64) (*mcp.CallToolResult, any, error) {
1004 usage, resp, err := client.Actions.GetWorkflowRunUsageByID(ctx, owner, repo, resourceID)
1005 if err != nil {
1006 return ghErrors.NewGitHubAPIErrorResponse(ctx, "failed to get workflow run usage", resp, err), nil, nil
1007 }
1008 defer func() { _ = resp.Body.Close() }()
1009
1010 r, err := json.Marshal(usage)
1011 if err != nil {
1012 return nil, nil, fmt.Errorf("failed to marshal response: %w", err)
1013 }
1014
1015 return utils.NewToolResultText(string(r)), nil, nil
1016}
1017
1018func runWorkflow(ctx context.Context, client *github.Client, owner, repo, workflowID, ref string, inputs map[string]any) (*mcp.CallToolResult, any, error) {
1019 event := github.CreateWorkflowDispatchEventRequest{

Callers 1

ActionsGetFunction · 0.85

Calls 2

NewToolResultTextFunction · 0.92
CloseMethod · 0.80

Tested by

no test coverage detected