feat: return workflow artifact contents from actions_get#2677
Open
rodboev wants to merge 1 commit into
Open
Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a content-returning path to
actions_getfor workflow artifacts, so callers can resolve an artifact by workflow run and exact name and receive bounded extracted file contents instead of dropping out to raw ZIP handling.Why
actions_listcan enumerate artifacts andactions_getcan return a signed download URL for a known artifact ID, but agents still have to chain raw REST calls, download a ZIP, and extract files outside MCP to inspect a run artifact. The issue'sagent-artifactsandtoken-usage.jsonlworkflow needs the server to bridge that metadata-to-content gap while preserving size limits, exact-name resolution, and binary safety.Fixes #2329
What changed
pkg/github/actions.go: extenddownload_workflow_run_artifacthandling to acceptrun_id,artifact_name, optionalpath, andmax_bytes, resolve the artifact by exact name, and download/extract bounded ZIP contents.pkg/github/actions.go: keep the existing artifact-id URL path for callers that pass onlyresource_id, cap archive downloads before ZIP parsing, and return metadata-only entries for binary or non-text files.pkg/github/actions_test.go: add focused mock tests for exact artifact-name resolution, missing artifact handling, legacy URL behavior, path filtering, bounded ZIP text extraction, archive-size rejection, and UTF-8-safe truncation.pkg/github/__toolsnaps__/actions_get.snapandREADME.md: regenerate schema and docs.MCP impact
actions_getkeepsdownload_workflow_run_artifactbut adds parameters for run/name content retrieval; existing artifact-id URL behavior stays available.Prompts tested (tool changes only)
agent-artifactsartifact from workflow run 123 and show metoken-usage.jsonl."agent-artifactsartifact from workflow run 123 and show menested/result.txtwith a 4 byte cap."Security / limits
Artifact contents are bounded by
max_bytes; artifact archives are capped before ZIP parsing; exactpathfiltering is optional; binary or non-UTF-8 entries return metadata only instead of unsafe content.Tool renaming
Lint & tests
Linted locally with
golangci-lint runTested locally with targeted package commands plus the required schema/doc generation commands
go test ./pkg/github -run "Test_ActionsGet|TestActionsGet|Test.*Artifact"— passed; covers theactions_getschema, legacy artifact-ID URL behavior, run/name artifact resolution, missing artifact errors, exact path filtering, truncation, archive-size rejection, UTF-8-safe truncation, and binary metadata-only output.$env:UPDATE_TOOLSNAPS='true'; go test ./pkg/github; Remove-Item env:UPDATE_TOOLSNAPS— passed; required fullpkg/githubtoolsnap regeneration command.bash script/generate-docs— passed; regeneratedREADME.md.golangci-lint run— passed with0 issues.Docs
Regenerated the generated README tool section with
bash script/generate-docs; restored unrelated generated docs so the final diff stays within the target allowlist.