pr-screenshots
GitHub辅助在PR描述中添加UI变更截图,避免提交图片触发CI重跑。通过脚本上传至自定义引用并生成链接,编辑PR正文展示对比图。
触发场景
安装
npx skills add lukevella/rallly --skill pr-screenshots -g -y
SKILL.md
Frontmatter
{
"name": "pr-screenshots",
"description": "Add screenshots of a visual change to a pull request description without pushing commits to the PR branch. Use whenever a PR needs screenshots, before\/after images, or any image in its body."
}
PR screenshots
Never commit screenshots to the PR branch. Every push there reruns CI and redeploys Vercel previews just to add images.
Images go to refs/meta/pr-assets on origin instead, one folder per PR. It is a custom ref, not a branch: GitHub Actions only run for main and pull requests, and Vercel deploys every pushed branch (refs/heads/*), so neither sees it. An orphan pr-assets branch would not work, because Vercel would try and fail to build it. Keep the ref two levels deep: GitHub accepts a single-level refs/pr-assets once, then rejects every push to it with "cannot lock ref"; only gh api -X DELETE repos/<owner>/<repo>/git/refs/pr-assets removes it.
Steps
-
Capture. Crop to the surface that changed, at a size where the text is legible. Show dark and light mode when the change has colour. Use a before/after pair when replacing something, a single shot for new UI. Crop with
sips -s format png --cropOffset <y> <x> -c <height> <width> <in> --out <out>.png. -
Confirm. Send the images to the user in chat and wait for approval before uploading. Tweaks after upload mean another upload.
-
Upload. From any checkout of the repo:
.claude/skills/pr-screenshots/upload.sh <pr-number> <file>...It prints one
raw.githubusercontent.comURL per file, pinned to the upload commit, and exits non-zero if a URL does not serve. -
Edit the body. Add a
## Screenshotssection above the checklist withgh pr edit <pr-number> --body-file <file>. Editing the body does not rerun CI. Put dark and light side by side:| Dark | Light | | -- | -- | |  |  |
Re-uploading a file with the same name is fine: the new URL carries the new commit, and old URLs keep serving the old image.
版本历史
- 04f7ce8 当前 2026-10-20 04:06


