Skip to content

Commit aa99024

Browse files
authored
fix: use RUNNER_TEMP for upload_artifact staging directory path (#25882)
1 parent 3e6c55e commit aa99024

13 files changed

+83
-25
lines changed

.github/workflows/api-consumption-report.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -303,17 +303,17 @@ Use `sns.set_theme(style="darkgrid")` for a professional dark-grid look and `plt
303303

304304
**You MUST copy the chart files to the staging directory before calling `upload_artifact`.**
305305

306-
The `upload_artifact` tool only reads files from `/tmp/gh-aw/safeoutputs/upload-artifacts/`. Run these commands first:
306+
The `upload_artifact` tool only reads files from `$RUNNER_TEMP/gh-aw/safeoutputs/upload-artifacts/`. Run these commands first:
307307

308308
```bash
309-
mkdir -p /tmp/gh-aw/safeoutputs/upload-artifacts/
310-
cp /tmp/gh-aw/python/charts/*.png /tmp/gh-aw/safeoutputs/upload-artifacts/
309+
mkdir -p "$RUNNER_TEMP/gh-aw/safeoutputs/upload-artifacts/"
310+
cp /tmp/gh-aw/python/charts/*.png "$RUNNER_TEMP/gh-aw/safeoutputs/upload-artifacts/"
311311
```
312312

313313
Then verify the files are in the staging directory:
314314

315315
```bash
316-
ls -la /tmp/gh-aw/safeoutputs/upload-artifacts/
316+
ls -la "$RUNNER_TEMP/gh-aw/safeoutputs/upload-artifacts/"
317317
```
318318

319319
After confirming the files exist in the staging directory, call `upload_artifact` for each chart using the **filename only** (not a subdirectory path). For example, use `path: "api_calls_trend.png"` — NOT `path: "charts/api_calls_trend.png"`.

.github/workflows/approach-validator.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ cat /tmp/gh-aw/approach-validator/agent4-dead-end-detector.md
224224
Write the full compiled report to a file for artifact upload (using the run ID for uniqueness):
225225

226226
```bash
227-
cat > /tmp/gh-aw/safeoutputs/upload-artifacts/approach-validation-report-${{ github.run_id }}.md << 'REPORT_EOF'
227+
cat > $RUNNER_TEMP/gh-aw/safeoutputs/upload-artifacts/approach-validation-report-${{ github.run_id }}.md << 'REPORT_EOF'
228228
[Full compiled report — see structure below]
229229
REPORT_EOF
230230
```

.github/workflows/audit-workflows.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Generate 2 charts from past 30 days workflow data:
5151
2. **Token & Cost**: Daily tokens (bar/area) + cost line + 7-day moving average
5252

5353
Save to: `/tmp/gh-aw/python/charts/{workflow_health,token_cost}_trends.png`
54-
Upload charts, embed in discussion with 2-3 sentence analysis each. Stage chart files to `/tmp/gh-aw/safeoutputs/upload-artifacts/` and call the `upload_artifact` safe-output tool for each chart. Record the returned `aw_*` IDs and include them in the discussion body along with a link to the [workflow run artifacts](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) so readers can download the charts.
54+
Upload charts, embed in discussion with 2-3 sentence analysis each. Stage chart files to `$RUNNER_TEMP/gh-aw/safeoutputs/upload-artifacts/` and call the `upload_artifact` safe-output tool for each chart. Record the returned `aw_*` IDs and include them in the discussion body along with a link to the [workflow run artifacts](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) so readers can download the charts.
5555

5656
---
5757

.github/workflows/daily-firewall-report.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ Generate exactly **2 high-quality trend charts**:
106106

107107
1. Stage both charts into the upload directory:
108108
```bash
109-
cp /tmp/gh-aw/python/charts/firewall_trends.png /tmp/gh-aw/safeoutputs/upload-artifacts/
110-
cp /tmp/gh-aw/python/charts/blocked_domains.png /tmp/gh-aw/safeoutputs/upload-artifacts/
109+
cp /tmp/gh-aw/python/charts/firewall_trends.png $RUNNER_TEMP/gh-aw/safeoutputs/upload-artifacts/
110+
cp /tmp/gh-aw/python/charts/blocked_domains.png $RUNNER_TEMP/gh-aw/safeoutputs/upload-artifacts/
111111
```
112112
2. Call the `upload_artifact` safe-output tool for each chart
113113
3. Record the returned `aw_*` IDs

.github/workflows/daily-performance-summary.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -368,9 +368,9 @@ print("Velocity metrics chart saved!")
368368
Stage and upload all three charts as artifacts with 30-day retention:
369369
1. Copy charts to the upload staging directory:
370370
```bash
371-
cp /tmp/gh-aw/python/charts/activity_overview.png /tmp/gh-aw/safeoutputs/upload-artifacts/
372-
cp /tmp/gh-aw/python/charts/resolution_metrics.png /tmp/gh-aw/safeoutputs/upload-artifacts/
373-
cp /tmp/gh-aw/python/charts/velocity_metrics.png /tmp/gh-aw/safeoutputs/upload-artifacts/
371+
cp /tmp/gh-aw/python/charts/activity_overview.png $RUNNER_TEMP/gh-aw/safeoutputs/upload-artifacts/
372+
cp /tmp/gh-aw/python/charts/resolution_metrics.png $RUNNER_TEMP/gh-aw/safeoutputs/upload-artifacts/
373+
cp /tmp/gh-aw/python/charts/velocity_metrics.png $RUNNER_TEMP/gh-aw/safeoutputs/upload-artifacts/
374374
```
375375
2. Call the `upload_artifact` safe-output tool for each chart
376376
3. Record the returned `aw_*` IDs for each chart

.github/workflows/docs-noob-tester.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,8 @@ For each confusing or broken area:
173173
- Note the page URL and specific section
174174
- Stage and upload the screenshot:
175175
```bash
176-
mkdir -p /tmp/gh-aw/safeoutputs/upload-artifacts
177-
cp /tmp/gh-aw/screenshots/<filename>.png /tmp/gh-aw/safeoutputs/upload-artifacts/
176+
mkdir -p $RUNNER_TEMP/gh-aw/safeoutputs/upload-artifacts
177+
cp /tmp/gh-aw/screenshots/<filename>.png $RUNNER_TEMP/gh-aw/safeoutputs/upload-artifacts/
178178
```
179179
Then call the `upload_artifact` safe-output tool with `path: "<filename>.png"`.
180180
Record the returned `aw_*` ID.

.github/workflows/shared/safe-output-upload-artifact.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ upload files as run-scoped GitHub Actions artifacts.
1414
1515
## How it works
1616
17-
The agent stages files to `/tmp/gh-aw/safeoutputs/upload-artifacts/` and calls the
17+
The agent stages files to `$RUNNER_TEMP/gh-aw/safeoutputs/upload-artifacts/` and calls the
1818
`upload_artifact` tool. The `safe_outputs` job picks up the staged files and uploads them
1919
directly via the `@actions/artifact` REST API (no `actions: write` permission needed —
2020
authentication uses `ACTIONS_RUNTIME_TOKEN` which is always available to the runner).
@@ -35,7 +35,7 @@ The agent must stage files before calling the tool:
3535
3636
```bash
3737
# Stage files to the upload-artifacts directory
38-
cp dist/report.json /tmp/gh-aw/safeoutputs/upload-artifacts/report.json
38+
cp dist/report.json "$RUNNER_TEMP/gh-aw/safeoutputs/upload-artifacts/report.json"
3939
```
4040
4141
Then call the tool:

.github/workflows/smoke-copilot.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ strict: false
144144
- Extract the discussion number from the result (e.g., if the result is `{"number": 123, "title": "...", ...}`, extract 123)
145145
- Use the `add_comment` tool with `discussion_number: <extracted_number>` to add a fun, playful comment stating that the smoke test agent was here
146146
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.
147-
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 /tmp/gh-aw/safeoutputs/upload-artifacts && cp ./gh-aw /tmp/gh-aw/safeoutputs/upload-artifacts/gh-aw`), then call the `upload_artifact` safe-output tool with `path: "gh-aw"`. 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.
147+
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"`. 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.
148148
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"
149149
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.
150150
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.

.github/workflows/unbloat-docs.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,8 @@ ls -lh /tmp/gh-aw/mcp-logs/playwright/
318318

319319
1. Stage each screenshot file to the artifact upload directory:
320320
```bash
321-
mkdir -p /tmp/gh-aw/safeoutputs/upload-artifacts
322-
cp /tmp/gh-aw/mcp-logs/playwright/<screenshot>.png /tmp/gh-aw/safeoutputs/upload-artifacts/
321+
mkdir -p $RUNNER_TEMP/gh-aw/safeoutputs/upload-artifacts
322+
cp /tmp/gh-aw/mcp-logs/playwright/<screenshot>.png $RUNNER_TEMP/gh-aw/safeoutputs/upload-artifacts/
323323
```
324324
2. Call the `upload_artifact` safe-output tool for each file
325325
3. Record the returned `aw_*` ID for each screenshot to include in the PR description

actions/setup/js/safe_outputs_tools.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -851,13 +851,13 @@
851851
},
852852
{
853853
"name": "upload_artifact",
854-
"description": "Upload files as a run-scoped GitHub Actions artifact. Files can be pre-staged in /tmp/gh-aw/safeoutputs/upload-artifacts/ or referenced by their original path — files not already in the staging directory are automatically copied there before upload. Absolute paths and paths relative to the workspace are supported. Returns a temporary artifact ID (aw_*) that can be resolved to a download URL by an authorised step. Retention and archive settings are fixed by workflow configuration. Exactly one of path or filters must be present.",
854+
"description": "Upload files as a run-scoped GitHub Actions artifact. Files can be pre-staged in $RUNNER_TEMP/gh-aw/safeoutputs/upload-artifacts/ or referenced by their original path — files not already in the staging directory are automatically copied there before upload. Absolute paths and paths relative to the workspace are supported. Returns a temporary artifact ID (aw_*) that can be resolved to a download URL by an authorised step. Retention and archive settings are fixed by workflow configuration. Exactly one of path or filters must be present.",
855855
"inputSchema": {
856856
"type": "object",
857857
"properties": {
858858
"path": {
859859
"type": "string",
860-
"description": "Path to the file or directory to upload. Can be relative to /tmp/gh-aw/safeoutputs/upload-artifacts/, an absolute path, or a path relative to the workspace. Files not already in the staging directory are automatically copied there. Required unless filters is provided."
860+
"description": "Path to the file or directory to upload. Can be relative to $RUNNER_TEMP/gh-aw/safeoutputs/upload-artifacts/, an absolute path, or a path relative to the workspace. Files not already in the staging directory are automatically copied there. Required unless filters is provided."
861861
},
862862
"filters": {
863863
"type": "object",

0 commit comments

Comments
 (0)