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

Function downloadWorkflowArtifact

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

Source from the content-addressed store, hash-verified

952}
953
954func downloadWorkflowArtifact(ctx context.Context, client *github.Client, owner, repo string, resourceID int64) (*mcp.CallToolResult, any, error) {
955 // Get the download URL for the artifact
956 url, resp, err := client.Actions.DownloadArtifact(ctx, owner, repo, resourceID, 1)
957 if err != nil {
958 return ghErrors.NewGitHubAPIErrorResponse(ctx, "failed to get artifact download URL", resp, err), nil, nil
959 }
960 defer func() { _ = resp.Body.Close() }()
961
962 // Create response with the download URL and information
963 result := map[string]any{
964 "download_url": url.String(),
965 "message": "Artifact is available for download",
966 "note": "The download_url provides a download link for the artifact as a ZIP archive. The link is temporary and expires after a short time.",
967 "artifact_id": resourceID,
968 }
969
970 r, err := json.Marshal(result)
971 if err != nil {
972 return nil, nil, fmt.Errorf("failed to marshal response: %w", err)
973 }
974
975 return utils.NewToolResultText(string(r)), nil, nil
976}
977
978func getWorkflowRunLogsURL(ctx context.Context, client *github.Client, owner, repo string, runID int64) (*mcp.CallToolResult, any, error) {
979 // Get the download URL for the logs

Callers 1

ActionsGetFunction · 0.85

Calls 3

NewToolResultTextFunction · 0.92
CloseMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected