You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE] Fetch images and other attachments from issues and PRs #2
changed the title [-][FEATURE] Fetch images and other attachments from issues[/-][+][FEATURE] Fetch images and other attachments from issues and PRs[/+]on Dec 11, 2025
Verdict: feasible, with a cleaner mechanism than direct download. Empirical tests run against live GitHub (test asset: a user-attachments image in a public org issue).
Key finding
Attachment URLs (https://github.com/user-attachments/assets/<uuid>) are not part of the REST API and do not accept Authorization: token for private repos. However, requesting bodies with the application/vnd.github.full+json media type returns body (raw markdown) andbody_html in a single call — and in body_html, GitHub has already rewritten every attachment (including legacy user-images.githubusercontent.com URLs in old issues) to a pre-signed JWT URL on private-user-images.githubusercontent.com.
Verified behavior:
The JWT URL downloads with plain unauthenticated HTTP (200, correct bytes). Same mechanism the github.com web UI uses → works uniformly for public and private repos.
The JWT is valid for 300 s → downloads must happen inside the per-item sync loop, re-fetching the item for a fresh JWT on expiry.
The signed URL path embeds the original asset UUID and file extension (/<userid>/<fileid>-<uuid>.<ext>?jwt=…), so it maps back to the raw-markdown URL by UUID and supplies the extension the raw URL lacks.
Raw bodies use two syntaxes: markdown  and HTML <img src="…"> — both must be rewritten. Videos use the same assets/<uuid> URLs.
Direct fetch of assets/<uuid> on a public repo: 302 → S3 URL (300 s validity), anonymous; the auth header is ignored. Not a viable route for private repos.
Proposed design
Opt-in sync-attachments input (default false, no behavior change).
Store as <output-dir>/attachments/<uuid>.<ext> — UUID-keyed: free dedup across issues/comments, no path-traversal risk from attacker-controlled filenames.
Rewrite raw-body URLs to relative paths (../attachments/<uuid>.<ext>) before formatting → tree is offline-portable. Never write JWT/S3 URLs into the markdown (they expire and would churn hasContentChanged every sync).
Downloaded files are added to modified-files; skip download when the file already exists (unless force-update).
Failure policy: per-attachment warning, keep the original absolute URL, never fail the sync.
Known gap
Non-image file attachments (github.com/user-attachments/files/<id>/<name> — zips, PDFs, logs) render in body_html as plain hrefs without a JWT. Public repos: direct GET works. Private repos: likely not fetchable with any token (no API exists). Untested — no private repo in our orgs currently has an attachment, and attachments cannot be uploaded via API. Plan: attempt direct download, warn and keep the original URL on failure.
Effort
With the body_html route this is closer to effort:medium than large: one new extract/map/download/rewrite module, media-type change on the fetch call sites, fixture-based tests, README/action.yml docs. No new dependencies (Node's global fetch suffices).
Activity
[-][FEATURE] Fetch images and other attachments from issues[/-][+][FEATURE] Fetch images and other attachments from issues and PRs[/+]fix(ci): split sync workflow auth between commit and release apps (#59)
c-vigo commentedon Jul 16, 2026
Spike results (2026-07-16)
Verdict: feasible, with a cleaner mechanism than direct download. Empirical tests run against live GitHub (test asset: a
user-attachmentsimage in a public org issue).Key finding
Attachment URLs (
https://github.com/user-attachments/assets/<uuid>) are not part of the REST API and do not acceptAuthorization: tokenfor private repos. However, requesting bodies with theapplication/vnd.github.full+jsonmedia type returnsbody(raw markdown) andbody_htmlin a single call — and inbody_html, GitHub has already rewritten every attachment (including legacyuser-images.githubusercontent.comURLs in old issues) to a pre-signed JWT URL onprivate-user-images.githubusercontent.com.Verified behavior:
200, correct bytes). Same mechanism the github.com web UI uses → works uniformly for public and private repos./<userid>/<fileid>-<uuid>.<ext>?jwt=…), so it maps back to the raw-markdown URL by UUID and supplies the extension the raw URL lacks.and HTML<img src="…">— both must be rewritten. Videos use the sameassets/<uuid>URLs.assets/<uuid>on a public repo:302→ S3 URL (300 s validity), anonymous; the auth header is ignored. Not a viable route for private repos.Proposed design
sync-attachmentsinput (defaultfalse, no behavior change).<output-dir>/attachments/<uuid>.<ext>— UUID-keyed: free dedup across issues/comments, no path-traversal risk from attacker-controlled filenames.../attachments/<uuid>.<ext>) before formatting → tree is offline-portable. Never write JWT/S3 URLs into the markdown (they expire and would churnhasContentChangedevery sync).modified-files; skip download when the file already exists (unlessforce-update).Known gap
Non-image file attachments (
github.com/user-attachments/files/<id>/<name>— zips, PDFs, logs) render inbody_htmlas plainhrefs without a JWT. Public repos: direct GET works. Private repos: likely not fetchable with any token (no API exists). Untested — no private repo in our orgs currently has an attachment, and attachments cannot be uploaded via API. Plan: attempt direct download, warn and keep the original URL on failure.Effort
With the
body_htmlroute this is closer to effort:medium than large: one new extract/map/download/rewrite module, media-type change on the fetch call sites, fixture-based tests, README/action.yml docs. No new dependencies (Node's globalfetchsuffices).test: cover attachment download and URL rewrite for issues and PRs
feat: add sync-attachments input to download and localize attachments
docs: document sync-attachments input and rebuild dist
feat: fetch images and other attachments from issues and PRs (#121)
chore: release 0.4.0 (#134)
test(ci): decouple include-closed scenario from live issue open-state (…