Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
465b20e
Initial plan: add upload_artifact safe output type
Copilot Apr 7, 2026
ff14be6
feat: add upload_artifact safe output type with native GitHub Actions…
Copilot Apr 7, 2026
60b0376
feat: add upload_artifact safe output type with native GitHub Actions…
Copilot Apr 7, 2026
1d4b6ad
fix: consolidate template literal concatenations in upload_artifact.cjs
Copilot Apr 7, 2026
a9e8f8f
feat: add upload-artifact to JSON schema (no enabled field required)
Copilot Apr 7, 2026
ae61a26
fix: use RUNNER_TEMP env var for artifact staging and slot paths
Copilot Apr 7, 2026
f962e66
feat: update smoke-copilot to upload gh-aw binary as artifact; fix up…
Copilot Apr 7, 2026
bedab80
fix: remove actions:write from upload_artifact job - uses ACTIONS_RUN…
Copilot Apr 7, 2026
fdeeba3
Add changeset
github-actions[bot] Apr 7, 2026
4efbf5b
fix: use runner.temp expression syntax in upload-artifact path inputs
Copilot Apr 7, 2026
d577e59
feat: handle upload_artifact inline in safe_outputs handler loop inst…
Copilot Apr 7, 2026
1684416
feat: use @actions/artifact REST API directly instead of actions/uplo…
Copilot Apr 7, 2026
f0d8940
fix: address review comments - fix range loop, update test mocks, add…
Copilot Apr 7, 2026
666601f
merge: merge main and recompile all workflows
Copilot Apr 7, 2026
6b2777f
merge: merge main and recompile all workflows
Copilot Apr 7, 2026
e9e9c61
Merge remote-tracking branch 'origin/main' into copilot/add-native-ar…
Copilot Apr 7, 2026
36c1694
merge: merge main and recompile all 182 workflows
Copilot Apr 7, 2026
221a3fa
fix: add rw mount and pre-create staging dir for upload_artifact
Copilot Apr 7, 2026
e1b9b28
fix: clarify upload_artifact tool is available in smoke-copilot prompt
Copilot Apr 7, 2026
b07adc9
fix: wire upload-artifact into import merge and add shared workflow
Copilot Apr 7, 2026
568e236
Add changeset
github-actions[bot] Apr 7, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/patch-add-upload-artifact-safe-output.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

58 changes: 58 additions & 0 deletions .github/workflows/shared/safe-output-upload-artifact.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
safe-outputs:
upload-artifact:
max-uploads: 3
default-retention-days: 7
max-retention-days: 30
allow:
skip-archive: true
---

<!--
# Shared Upload Artifact Safe Output Configuration

This shared workflow enables the `upload_artifact` safe output tool, which lets AI agents
upload files as run-scoped GitHub Actions artifacts.

## How it works

The agent stages files to `$RUNNER_TEMP/gh-aw/safeoutputs/upload-artifacts/` and calls the
`upload_artifact` tool. The `safe_outputs` job picks up the staged files and uploads them
directly via the `@actions/artifact` REST API (no `actions: write` permission needed —
authentication uses `ACTIONS_RUNTIME_TOKEN` which is always available to the runner).

The tool returns a temporary opaque artifact ID (`tmp_artifact_*`) that can be resolved to
a download URL by an authorised downstream step.

## Usage

Import this shared workflow to enable `upload_artifact` in any workflow:

```yaml
imports:
- shared/safe-output-upload-artifact.md
```

The agent must stage files before calling the tool:

```bash
# Stage files to the upload-artifacts directory
cp dist/report.json $RUNNER_TEMP/gh-aw/safeoutputs/upload-artifacts/report.json
```

Then call the tool:

```json
{ "type": "upload_artifact", "path": "report.json", "retention_days": 7 }
```

## Configuration defaults

- `max-uploads`: 3 uploads per run
- `default-retention-days`: 7 days
- `max-retention-days`: 30 days
- `allow.skip-archive`: true (single-file uploads can skip zip archiving)

Override any of these by defining `upload-artifact` directly in your workflow's
`safe-outputs` section (the top-level definition takes precedence over the import).
-->
71 changes: 45 additions & 26 deletions .github/workflows/smoke-copilot.lock.yml

Large diffs are not rendered by default.

13 changes: 10 additions & 3 deletions .github/workflows/smoke-copilot.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ runtimes:
version: "1.25"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The safe-outputs block is well-structured. The upload-artifact config with retention-days: 1 and max-uploads: 1 is appropriately scoped for a smoke test workflow — avoids unnecessary artifact accumulation.

safe-outputs:
allowed-domains: [default-safe-outputs]
upload-artifact:
max-uploads: 1
default-retention-days: 1
max-retention-days: 1
allow:
skip-archive: true
add-comment:
allowed-repos: ["github/gh-aw"]
hide-older-comments: true
Expand Down Expand Up @@ -140,9 +146,10 @@ strict: false
- Extract the discussion number from the result (e.g., if the result is `{"number": 123, "title": "...", ...}`, extract 123)
- Use the `add_comment` tool with `discussion_number: <extracted_number>` to add a fun, playful comment stating that the smoke test agent was here
9. **Build gh-aw**: Run `GOCACHE=/tmp/go-cache GOMODCACHE=/tmp/go-mod make build` to verify the agent can successfully build the gh-aw project (both caches must be set to /tmp because the default cache locations are not writable). If the command fails, mark this test as ❌ and report the failure.
10. **Discussion Creation Testing**: Use the `create_discussion` safe-output tool to create a discussion in the announcements category titled "copilot was here" with the label "ai-generated"
11. **Workflow Dispatch Testing**: Use the `dispatch_workflow` safe output tool to trigger the `haiku-printer` workflow with a haiku as the message input. Create an original, creative haiku about software testing or automation.
12. **PR Review Testing**: Review the diff of the current pull request. Leave 1-2 inline `create_pull_request_review_comment` comments on specific lines, then call `submit_pull_request_review` with a brief body summarizing your review and event `COMMENT`. To test `reply_to_pull_request_review_comment`: use the `pull_request_read` tool (with `method: "get_review_comments"` and `pullNumber: ${{ github.event.pull_request.number }}`) to fetch the PR's existing review comments, then reply to the most recent one using `reply_to_pull_request_review_comment` with its actual numeric `id` as the `comment_id`. Note: `create_pull_request_review_comment` does not return a `comment_id` — you must fetch existing comment IDs from the GitHub API. If the PR has no existing review comments, skip the reply sub-test.
10. **Upload gh-aw binary as artifact**: After a successful build, use bash to copy the `./gh-aw` binary into the staging directory (`mkdir -p $RUNNER_TEMP/gh-aw/safeoutputs/upload-artifacts && cp ./gh-aw $RUNNER_TEMP/gh-aw/safeoutputs/upload-artifacts/gh-aw`), then call the `upload_artifact` safe-output tool with `path: "gh-aw"`, `retention_days: 1`, and `skip_archive: true`. The `upload_artifact` tool is available and configured in this workflow run — use it directly, do NOT use `missing_tool` for it. Mark this test as ❌ if the build in step 9 failed.
11. **Discussion Creation Testing**: Use the `create_discussion` safe-output tool to create a discussion in the announcements category titled "copilot was here" with the label "ai-generated"
12. **Workflow Dispatch Testing**: Use the `dispatch_workflow` safe output tool to trigger the `haiku-printer` workflow with a haiku as the message input. Create an original, creative haiku about software testing or automation.
13. **PR Review Testing**: Review the diff of the current pull request. Leave 1-2 inline `create_pull_request_review_comment` comments on specific lines, then call `submit_pull_request_review` with a brief body summarizing your review and event `COMMENT`. To test `reply_to_pull_request_review_comment`: use the `pull_request_read` tool (with `method: "get_review_comments"` and `pullNumber: ${{ github.event.pull_request.number }}`) to fetch the PR's existing review comments, then reply to the most recent one using `reply_to_pull_request_review_comment` with its actual numeric `id` as the `comment_id`. Note: `create_pull_request_review_comment` does not return a `comment_id` — you must fetch existing comment IDs from the GitHub API. If the PR has no existing review comments, skip the reply sub-test.

## Output

Expand Down
4 changes: 4 additions & 0 deletions actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ inputs:
description: 'Install @actions/github for handlers that use a per-handler github-token (creates Octokit via getOctokit)'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new safe-output-artifact-client input is cleanly named and follows the existing pattern with required: false and default: 'false'. This is a good minimal addition that keeps the action composable.

required: false
default: 'false'
safe-output-artifact-client:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good addition — safe-output-artifact-client is well-described and defaults to 'false' to avoid unnecessary installs. The @actions/artifact dependency for uploading artifacts via REST API is the right approach here. 🤖 Smoke test Run 24087078851

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Smoke test agent dropping in! The safe-output-artifact-client input is a clean approach — only installing @actions/artifact when needed keeps the setup lean. Confirmed working in run §24091825630. ✅

📰 BREAKING: Report filed by Smoke Copilot · ● 1.4M

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Smoke test agent here! The safe-output-artifact-client input is well-designed — conditional install of @actions/artifact keeps setup lean. Confirmed working in run §24107238086. ✅

description: 'Install @actions/artifact so upload_artifact.cjs can upload GitHub Actions artifacts via REST API directly'
required: false
default: 'false'
job-name:
description: 'Name of the job being set up. When OTEL_EXPORTER_OTLP_ENDPOINT is configured, a gh-aw.<job-name>.setup span is pushed to the OTLP endpoint.'
required: false
Expand Down
1 change: 1 addition & 0 deletions actions/setup/js/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"devDependencies": {
"@actions/artifact": "^6.0.0",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Smoke test agent agrees! Pinning to a specific version like 6.0.0 would be a great improvement for supply-chain security. Confirmed working in run §24107238086. ✅

📰 BREAKING: Report filed by Smoke Copilot · ● 1.5M

"@actions/core": "^3.0.0",
"@actions/exec": "^3.0.0",
"@actions/github": "^9.0.0",
Expand Down
1 change: 1 addition & 0 deletions actions/setup/js/safe_output_handler_manager.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ const HANDLER_MAP = {
create_project: "./create_project.cjs",
create_project_status_update: "./create_project_status_update.cjs",
update_project: "./update_project.cjs",
upload_artifact: "./upload_artifact.cjs",
};

/**
Expand Down
Loading