Gh Pr With Screenshots
Overview
Create or update a PR for the current branch, capture UI screenshots, commit them under screenshots/, and embed them in the PR description.
Workflow (Default)
- Verify branch + status
- Ensure you are not on
main. - If there are uncommitted changes not meant for the PR, stop and ask.
- Push branch + ensure PR exists
- Push current branch to origin.
- Check for an existing PR from this branch.
- Create PR against
mainif missing.
- Capture screenshots
- Use
browser-toolsto open the UI and capture screenshots. - Save files under
screenshots/with clear names.
- Commit screenshots + push
- Add new screenshots, commit, and push.
- Update PR description
- Use markdown image links with
blob/... ?raw=1URLs. - Replace or append a
## Screenshotssection.
Commands and Patterns
A) PR discovery + creation (gh)
# current branch
branch=$(git rev-parse --abbrev-ref HEAD)
# push branch
git push -u origin "$branch"
# find PR for this branch
pr_number=$(gh pr list --head "$branch" --json number -q '.[0].number')
# create PR if missing
if [ -z "$pr_number" ]; then
pr_url=$(gh pr create --base main --head "$branch" --fill)
pr_number=$(gh pr view --json number -q '.number')
fi
B) Capture screenshots (browser automation)
Use a browser automation tool (agent-browser, Playwright, Puppeteer) to capture screenshots. Example with agent-browser:
agent-browser open http://localhost:5173
agent-browser screenshot screenshots/feature-default.png
Move files into screenshots/:
mkdir -p screenshots
mv /tmp/screenshot-*.png screenshots/skills-dashboard-default.png
C) Commit screenshots
git add screenshots/*.png
git commit -m "Add PR screenshots"
git push
D) PR body markdown with stable URLs
Use blob URLs for private repos:
https://github.com/<ORG>/<REPO>/blob/<BRANCH>/screenshots/<FILE>?raw=1
Example ## Screenshots section:
## Screenshots
**Skills dashboard (default)**

**Skills dashboard with active filters**

Update PR body (simple replace):
gh pr edit "$pr_number" --body-file /tmp/pr_body.md
If you must preserve existing body content:
- Read current body with
gh pr view --json body -q .body - Replace or append the
## Screenshotssection and write it back withgh pr edit.
Notes
- Prefer
blob/... ?raw=1links for private repos (more reliable thanraw.githubusercontent.com). - When in doubt, verify the PR page using browser-tools.
Converted and distributed by TomeVault — claim your Tome and manage your conversions.