feat: add upload-artifact safe output type for run-scoped GitHub Actions artifact uploads#25002
feat: add upload-artifact safe output type for run-scoped GitHub Actions artifact uploads#25002
Conversation
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/06153ed3-a241-400b-9414-3dc304516475 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
… artifact support Agent-Logs-Url: https://github.com/github/gh-aw/sessions/06153ed3-a241-400b-9414-3dc304516475 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
… artifact support Agent-Logs-Url: https://github.com/github/gh-aw/sessions/06153ed3-a241-400b-9414-3dc304516475 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
@copilot keep working |
|
@copilot remove "enabled: true" |
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/e2c3d991-4ccd-4c47-8a7b-53d9905e1444 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Addressed the remaining code review feedback (consolidating split template literals into single template literals in Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/8dce883a-59fd-437b-a8ba-9dc9587acc98 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Done in Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot use runner_temp env var like other temp folders |
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/05ddc6f7-ae5e-4faa-9423-6f551a67af06 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Done in
Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot update smoke-copilot to upload the gh-aw binary as artifact using the safe output and set a 1 day retention, skip-artifact. |
…load_artifact job permissions and duplicate step bug Agent-Logs-Url: https://github.com/github/gh-aw/sessions/c901fdd4-ee9b-47d2-a4e6-ebe13975e3a4 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Done in
Also fixed two bugs found during testing: the Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot creation of artifacts does not require actions: write since it uses this secret: ACTIONS_RUNTIME_TOKEN Review source code of @actions/upload-artifact for reference |
…TIME_TOKEN instead Agent-Logs-Url: https://github.com/github/gh-aw/sessions/4404709a-1bdd-4947-b526-9edf180e24cc Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤 |
|
@copilot investigate why upload-artifact failed. https://github.com/github/gh-aw/actions/runs/24087078884/job/70263013213 |
The ${RUNNER_TEMP}/gh-aw directory is mounted read-only in the agent
container (awf --mount :ro), preventing the model from writing staged
files to upload-artifacts/. Fix by:
1. Pre-creating ${RUNNER_TEMP}/gh-aw/safeoutputs/upload-artifacts/
before awf starts (mcp_setup_generator.go) so it can be bind-mounted
2. Adding --mount :rw for that subdirectory in the awf command
(awf_helpers.go) — child mount overrides parent :ro permission
3. Allowlisting upload_artifact.cjs for @actions/artifact in the CJS
require validation test (package installed at runtime via setup.sh)
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/2842a7ad-1e1e-4045-b23f-312ccc7878d1
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Root cause found and fixed in The Two fixes:
Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
🎬 THE END — Smoke Claude MISSION: ACCOMPLISHED! The hero saves the day! ✨ |
|
✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟 |
|
📰 BREAKING: Smoke Copilot is now investigating this pull request. Sources say the story is developing... |
|
✅ All tools validated successfully! Agent Container Smoke Test confirms agent container is ready. |
Agent Container Tool Check
Result: 12/12 tools available ✅ — PASS
|
|
Smoke test (run 24091825601)
|
|
🤖 Smoke test §24091825630 —
Overall:
|
There was a problem hiding this comment.
🤖 Smoke test review from run §24091825630. The upload-artifact safe output implementation looks solid — changeset is clear, config is well-structured with sensible defaults (1-day retention, 100MB max). No blocking issues found.
📰 BREAKING: Report filed by Smoke Copilot · ● 1.4M
| "gh-aw": patch | ||
| --- | ||
|
|
||
| Add a new `upload-artifact` safe output type for run-scoped GitHub Actions artifact uploads, including frontmatter configuration, validation, and runtime handling that returns temporary artifact IDs for downstream resolution. |
There was a problem hiding this comment.
🤖 Smoke test agent here! This changeset entry clearly describes the new upload-artifact safe output type. The mention of temporary artifact IDs for downstream resolution is helpful context. Run §24091825630
|
📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤 |
|
💥 Smoke test §24091825535 — PARTIAL (16 ✅, 3
|
There was a problem hiding this comment.
💥 Automated smoke test review - all systems nominal!
💥 [THE END] — Illustrated by Smoke Claude · ● 282.9K
| description: 'Install @actions/github for handlers that use a per-handler github-token (creates Octokit via getOctokit)' | ||
| required: false | ||
| default: 'false' | ||
| safe-output-artifact-client: |
There was a problem hiding this comment.
New safe-output-artifact-client input looks good — follows the existing input pattern. Consider adding a comment noting that this installs @actions/artifact for the upload_artifact.cjs handler to make the dependency explicit for maintainers.
| @@ -1,5 +1,6 @@ | |||
| { | |||
| "devDependencies": { | |||
| "@actions/artifact": "^6.0.0", | |||
There was a problem hiding this comment.
Adding @actions/artifact as a dev dependency with ^6.0.0 — good choice. This version supports run-scoped artifact uploads. Pinning to a more specific version (e.g. 6.0.0) would improve reproducibility and supply-chain security.
|
@copilot Validate upload-artigacr worked and create and artifact https://github.com/github/gh-aw/actions/runs/24091825630/job/70281194992#step:9:1 |
The agent was using missing_tool for upload_artifact because it inferred the tool "wasn't available" (reading PR #25002 that adds it). Added an explicit note to the step 10 prompt making clear that upload_artifact IS configured and available in this run — agents must use it directly, not report it as missing. Agent-Logs-Url: https://github.com/github/gh-aw/sessions/ec3258ef-7bfb-40b6-a4b7-db15e0eab9db Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Validated in From run 24091825630:
The handler infrastructure is fully wired. The agent incorrectly inferred the tool wasn't available because it was reviewing this PR. Fixed the Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Adds a new
upload-artifactsafe output type that lets AI agents declaratively request GitHub Actions artifact uploads — distinct from the existingupload-asset(git orphan branch) path. Returns a temporary opaque artifact ID rather than a raw download URL, keeping authorization and auditing centralized.Design
The model stages files to
$RUNNER_TEMP/gh-aw/safeoutputs/upload-artifacts/and emitsupload_artifactrecords. Thesafe_outputsjob runs theupload_artifacthandler inline in the unified handler loop (same as all other safe output types). The handler uploads approved files directly via the@actions/artifactREST API client (DefaultArtifactClient.uploadArtifact()) — no compiled YAML slot steps and no separate standalone job required.Temporary IDs use the format
tmp_artifact_<26 uppercase alphanumeric chars>and are written to a resolver file for downstream steps.All staging and resolver paths use
process.env.RUNNER_TEMPin JavaScript — consistent with all other temp folders in the codebase.No special workflow permissions are required —
@actions/artifactauthenticates viaACTIONS_RUNTIME_TOKENwhich is automatically available to the runner.Front matter
The feature is enabled simply by including the
upload-artifact:section (noenabled: truerequired — same pattern asupload-asset):Output payload (model-emitted)
{ "type": "upload_artifact", "path": "dist/report.json", "retention_days": 14 } { "type": "upload_artifact", "filters": { "include": ["reports/**/*.json"], "exclude": ["reports/private/**"] } } { "type": "upload_artifact", "path": "dist/app.bin", "skip_archive": true }Changes
pkg/workflow/publish_artifacts.go—UploadArtifactConfig(withArtifactFiltersConfig,ArtifactDefaultsConfig,ArtifactAllowConfig), frontmatter parser, staging artifact upload step generatoractions/setup/js/upload_artifact.cjs— per-message handler:main(config)returns a handler function called once perupload_artifactmessage; handles path/filter resolution against staging dir, allowed-paths policy, skip-archive single-file constraint, size validation, direct upload viaDefaultArtifactClient.uploadArtifact()(injectable viaglobal.__createArtifactClientfor tests), temp ID generation + resolver file writeactions/setup/action.yml— addedsafe-output-artifact-clientinput; whentrue, setup installs@actions/artifactinto the actions destination directoryactions/setup/setup.sh— added@actions/artifactnpm install block whenINPUT_SAFE_OUTPUT_ARTIFACT_CLIENT=truepkg/workflow/compiler_yaml_step_generation.go— addedenableArtifactClient boolparameter togenerateSetupStep; emits the new input when enabledpkg/workflow/compiler_safe_outputs_job.go— passesenableArtifactClient=truewhenUploadArtifactis configured; removed N conditionalactions/upload-artifactYAML slot steps (uploads now happen inside the JS handler)pkg/workflow/js/safe_outputs_tools.json— MCP tool schema forupload_artifactsafe_output_handler_manager.cjs—upload_artifactinHANDLER_MAP(inline handler loop)pkg/parser/schemas/main_workflow_schema.json—upload-artifactadded to the safe-outputs schema (noenabledfield).github/workflows/smoke-copilot.md— exercises the feature end-to-endcompiler_types.go,safe_outputs_state.go,safe_outputs_config.go,safe_outputs_tools_computation.go,compiler_safe_outputs_config.go,compiler_safe_output_jobs.go,compiler_yaml_main_job.goValidation rules enforced at runtime
pathorfiltersrequired..traversal, no symlinksallowed-pathspolicyskip_archive: true→ exactly one file; fails if glob expands to multiplemax-size-bytes[1, max-retention-days]max-uploadsChangeset
upload-artifactsafe output type for run-scoped GitHub Actions artifact uploads, including frontmatter config, runtime handling via@actions/artifactREST API, and validation rules.✨ PR Review Safe Output Test - Run 24087078851
✨ PR Review Safe Output Test - Run 24091825535