Skip to content

fix: use upload_asset instead of upload_artifact for chart image embedding in discussions#26269

Closed
Copilot wants to merge 1 commit intomainfrom
copilot/fix-upload-artifact-image-links
Closed

fix: use upload_asset instead of upload_artifact for chart image embedding in discussions#26269
Copilot wants to merge 1 commit intomainfrom
copilot/fix-upload-artifact-image-links

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 14, 2026

Summary

Fixes broken image links in GitHub discussions (e.g. #26211).

Root Cause

Workflows like api-consumption-report.md were using upload_artifact with temporary_id to upload chart images, then embedding them in discussions as ![chart](#aw_chart_id). After the safe-output manager resolved the temporary IDs, discussions ended up with:

![GitHub API Calls Trend](https://github.com/github/gh-aw/actions/runs/123/artifacts/456)

These artifact URLs require GitHub authentication — they redirect through an authenticated flow to Azure Blob Storage. GitHub's image proxy (Camo) cannot authenticate this redirect, so <img> tags using artifact URLs always load broken.

Fix

Replace upload-artifact safe-output configuration (used for image embedding) with upload-asset in the shared workflow components. The upload_asset tool:

  1. Returns the permanent URL immediately to the agent — https://github.com/repo/blob/assets/…?raw=true
  2. Pushes the file to a permanent git branch (no expiry unlike 30-day artifact retention)
  3. The ?raw=true URL renders as an inline image for authenticated GitHub users

The agent now receives the URL directly and embeds it literally, rather than using a #aw_temporary_id placeholder that gets swapped in later.

Changes

File Change
shared/trending-charts-simple.md Replace upload-artifact safe-output with upload-asset; update agent instructions
shared/python-dataviz.md Same
api-consumption-report.md Remove own upload-artifact config (shared import provides upload-asset); rewrite Step 5 to use upload_asset and Step 6 to use direct URLs instead of #aw_* placeholders
.github/aw/charts.md Fix documentation examples to show upload-asset configuration
*.lock.yml Recompiled — affected workflows now include an upload_assets job with contents: write

…dding in discussions

Fixes broken image links in discussions (e.g. #26211).

upload_artifact URLs require GitHub authentication (redirect to Azure
Blob Storage via an auth flow). GitHub's image proxy (Camo) cannot
authenticate, so images embedded as ![chart](artifact_url) in
discussions always appear broken.

upload_asset pushes files to a permanent git branch and returns
https://github.com/repo/blob/branch/{sha}?raw=true URLs that render
correctly as inline images and never expire.

Agent-Logs-Url: https://github.com/github/gh-aw/sessions/eed4c740-ea5e-4d55-865e-7daa25ffeea9

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants