← ClaudeAtlas

rjv-github-image-uploadlisted

Upload local images to GitHub and embed them in a PR/issue/comment as canonical github.com/user-attachments URLs (private repos stay private), via the gh-image CLI. Triggers: 'attach a screenshot to the PR', 'add an image to the PR/issue', 'show test results in the PR', 'embed before/after screenshots'.
rjvim/ai-skills · ★ 0 · Code & Development · score 66
Install: claude install-skill rjvim/ai-skills
# Upload images to GitHub (gh-image) GitHub has **no public API** for image uploads — the web UI uses an internal endpoint that mints `user-attachments` URLs scoped to the repo's visibility. [`gh-image`](https://github.com/drogers0/gh-image) (MIT, © drogers0) replicates that flow as a `gh` CLI extension, so you can upload from the terminal and get a ready-to-embed `![name](url)` back. This skill drives `gh-image` and then embeds the result into a PR/issue/comment. ## Prerequisites — verify these before uploading Run these checks; only act on the ones that fail. 1. **`gh` CLI installed & authenticated** ```bash gh auth status ``` If it fails, tell the user to run `gh auth login` (do not attempt it unattended). 2. **The `gh-image` extension installed** (idempotent — skip if already present) ```bash gh extension list | grep -q 'drogers0/gh-image' || gh extension install drogers0/gh-image ``` 3. **A GitHub session for the upload.** `gh-image` does NOT use the `gh` token for the upload (that endpoint rejects tokens); it needs the browser `user_session` cookie. Resolution order (first match wins): - `--token <value>` flag, or - `GH_SESSION_TOKEN` env var (use this in CI / headless), or - the cookie store of a logged-in browser (Chrome/Brave/Chromium/Edge/Firefox/ Opera/Safari) — the default for local use. On macOS the first read may show a Keychain prompt; the user should click **Always Allow**. > ⚠️ A `user_session` cookie