Merge pull request #4625 from rommapp/claude/gh-attach-screenshots

docs: upload PR screenshots with gh --attach
This commit is contained in:
Georges-Antoine Assi
2026-09-18 16:43:05 -04:00
committed by GitHub
3 changed files with 24 additions and 10 deletions

View File

@@ -87,8 +87,9 @@ verdict, what steps 2 and 3 changed by area, which checks ran and their results,
and anything still needing a human decision.
The summary also carries what the PR description needs and the transcripts hold: the
screenshots step 4 captured, as paths the user can drag into the `Screenshots` section,
and the `mermaid` block for a change that moved a boundary.
screenshots step 4 captured, which the PR body references and `gh ... --attach` uploads
under the `Screenshots` heading, and the `mermaid` block for a change that moved a
boundary.
Four passes in one session is a lot of context. For a very large diff, run the
steps in separate sessions against the same `$RANGE`.

View File

@@ -212,13 +212,26 @@ reviewer the gist, and stop there: one shot carries most changes.
wouldn't read as different, labelled as such.
- **A second theme** only when the change is theme-dependent; a state or breakpoint only when it's
the point of the change.
- Name the files for what they show (`missing-games-actions.png`), so the handoff list reads on
its own.
- Name the files for what they show (`missing-games-actions.png`); the filename is the alt text
when you don't supply one.
Attachments on github.com live under `user-attachments`, and nothing uploads there from the CLI.
So unless you have a URL the PR body can point at, open the PR with the heading and a one-line
placeholder naming each shot, then give the user the file paths in your summary to drag into the
description. Never commit the images or push them to a branch to get a URL.
Upload them yourself with `gh`, which takes `--attach '<file>#<alt text>'` (up to 50 per command)
on `pr create`, `pr edit` and `pr comment`. Write the body referencing each file by its local path
and `gh` rewrites the reference to the uploaded asset, so the shots land under the `Screenshots`
heading instead of being appended at the end:
```bash
# /tmp/pr-body.md, under the Screenshots heading:
# ![The new actions row on a missing game](/tmp/shots/missing-games-actions.png)
gh pr create --title '...' --body-file /tmp/pr-body.md \
--attach /tmp/shots/missing-games-actions.png
```
On an existing PR, `gh pr edit --attach` keeps the current body and appends the upload unless the
body already references the file. A partial upload still creates or updates the PR and exits
non-zero, so check the body rather than trusting the exit code. Never commit the images or push
them to a branch to get a URL. Only fall back to handing the user file paths when the upload
fails.
### Mermaid diagram, for an architectural change
@@ -263,6 +276,6 @@ flowchart LR
- [ ] UI changes tested in the browser: both themes, all four input modalities,
responsive sweep
- [ ] UI changes screenshotted (enough to convey the change), and the shots
attached to the PR or handed to the user
uploaded to the PR with `gh ... --attach`
- [ ] Architectural changes carry a `mermaid` diagram in the PR description
- [ ] `trunk fmt && trunk check` clean, with whatever fmt rewrote committed

View File

@@ -74,7 +74,7 @@ These live in `.claude/skills/` and carry the detailed rules. Invoke the one tha
**Python tools live in `backend/tools/`.** Standalone dev/test utilities and scripts (not part of the app runtime) go in `backend/tools/`, not scattered across `backend/`.
**Link PRs to issues.** In the PR description, use `Fixes #XXXX` for issue/bug fixes and `Closes #XXXX` for feature implementations.
**Use the PR template.** Base every PR description on `.github/PULL_REQUEST_TEMPLATE.md`.
**Show UI changes in the PR.** A PR that touches anything visible ships with at least one screenshot under the template's `Screenshots` heading, captured from the running app during the `review-polish` browser pass. Enough shots to convey what changed, not a catalogue of every state. Save the files outside the repo and never commit them. If you can't attach them to the PR yourself, open the PR with the section in place and hand the user the file paths to drop in.
**Show UI changes in the PR.** A PR that touches anything visible ships with at least one screenshot under the template's `Screenshots` heading, captured from the running app during the `review-polish` browser pass. Enough shots to convey what changed, not a catalogue of every state. Save the files outside the repo and never commit them, and upload them with `gh pr create --attach` (or `gh pr edit --attach` on an existing PR) rather than handing the paths to the user.
**Diagram architectural changes in the PR.** When a change moves a boundary (a new service, task, or provider in a path, a model relationship, a different call path across layers, an auth or socket flow), the PR description carries a `mermaid` block showing it. GitHub renders them. Draw what changed, not the whole system. See `review-polish`.
---