Skip to content

tooling: attach screenshots to a PR from the CLI (scripts/pr-image.sh)#215

Merged
hellno merged 1 commit into
mainfrom
hellno/pr-image-helper
Jul 8, 2026
Merged

tooling: attach screenshots to a PR from the CLI (scripts/pr-image.sh)#215
hellno merged 1 commit into
mainfrom
hellno/pr-image-helper

Conversation

@hellno

@hellno hellno commented Jul 8, 2026

Copy link
Copy Markdown
Owner

We keep hitting the same wall: gh can't upload an image into GitHub markdown, so screenshots don't make it onto a PR from a headless/CLI session. This adds a small, reusable fix.

What

scripts/pr-image.sh <image> ... parks the PNG(s) on a dedicated orphan assets branch and prints paste-ready markdown:

![before](https://raw.githubusercontent.com/hellno/deckard/assets/198-before-you-are-sending.png)

GitHub renders ![](url) for any URL returning image bytes, and this is a public repo, so its own raw.githubusercontent.com serves them.

Why it's safe

  • Pure git plumbing (hash-objectmktreecommit-treepush) — never touches your working tree, index, or HEAD, and never switches branches.
  • The assets branch is orphan: never merged, never in a PR diff.
  • Appends — old images survive; a same-named file is replaced.
  • Refuses a private repo (its raw URLs won't render for viewers → drag-drop in the web UI there instead).

Proof it works

Already used it to land the before/after review-card screenshots on #214 (the dapp-origin PR). shellcheck-clean; self-tested the append path.

Documented in docs/dev/driving-the-app.md → "Attaching a screenshot to a PR".

gh can't upload images into GitHub markdown (that's the web UI's private upload
endpoint). This parks a PNG on a dedicated orphan 'assets' branch via git
plumbing (no working-tree/index/HEAD change, never in a PR diff) and prints
paste-ready ![](raw.githubusercontent.com/...) markdown that renders inline.
Appends (old images survive), replaces same-named files, and refuses a private
repo whose raw URLs wouldn't render. Documented in docs/dev/driving-the-app.md.
@hellno
hellno merged commit 75a7367 into main Jul 8, 2026
5 checks passed
@hellno
hellno deleted the hellno/pr-image-helper branch July 8, 2026 09:23
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.

1 participant