update-screenshots by microsoft/vscode
npx skills add https://github.com/microsoft/vscode --skill update-screenshots当被要求从 CI 更新、接受或刷新截图基线时——或者当 Screenshot Tests GitHub Action 因截图差异而失败时——请遵循此流程下载 CI 生成的截图并将其提交为新的基线。
本地捕获的截图可能因平台差异(字体、渲染、DPI)而与 CI 不同。CI(Linux, ubuntu-latest)是事实来源。此技能下载 CI 生成的截图并将其提交为基线。
gh CLI 必须已认证(gh auth status)。Screenshot Tests GitHub Action 必须已运行并生成了 screenshot-diff 工件。如果用户提供了特定的运行 ID 或 PR 编号,请使用它。否则,查找最近的运行:
# 对于特定的 PR:
gh run list --workflow screenshot-test.yml --branch <branch> --limit 5 --json databaseId,status,conclusion,headBranch
# 对于当前分支:
gh run list --workflow screenshot-test.yml --branch $(git branch --show-current) --limit 5 --json databaseId,status,conclusion
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
选择最近一个拥有 screenshot-diff 工件的运行(截图已匹配的运行不会有此工件)。
gh run download <run-id> --name screenshot-diff --dir .tmp/screenshot-diff
工件从两个路径上传(test/componentFixtures/.screenshots/current/ 和 test/componentFixtures/.screenshots/report/),但 GitHub Actions 会剥离公共前缀。因此下载的结构是:
current/ — CI 捕获的截图(例如 current/baseUI/Buttons/Dark.png)report/report.json — 结构化的差异报告report/report.md — 人类可读的差异报告通过读取 markdown 报告向用户展示发生了什么变化:
cat .tmp/screenshot-diff/report/report.md
# 删除旧的基线并用 CI 截图替换
rm -rf test/componentFixtures/.screenshots/baseline/
cp -r .tmp/screenshot-diff/current/ test/componentFixtures/.screenshots/baseline/
rm -rf .tmp/screenshot-diff
git add test/componentFixtures/.screenshots/baseline/
git commit -m "update screenshot baselines from CI"
截图基线存储在 Git LFS 中。此仓库中的 git lfs pre-push 钩子未激活(husky 覆盖了它),因此 LFS 对象不会在 git push 时自动上传。你必须在推送分支前手动推送它们,否则推送将失败并显示 GH008: Your push referenced unknown Git LFS objects。
git lfs push --all origin <branch-name>
git push
通过列出文件确认基线已更新:
git diff --stat HEAD~1
screenshot-diff 工件,则截图已与基线匹配——无需更新。--filter 选项来有选择地仅接受某些夹具。每周安装量
182
代码仓库
GitHub 星标数
183.0K
首次出现
2026年2月22日
安全审计
安装于
cursor182
gemini-cli182
codex182
github-copilot182
amp182
kimi-cli182
When asked to update, accept, or refresh screenshot baselines from CI — or when the Screenshot Tests GitHub Action has failed with screenshot differences — follow this procedure to download the CI-generated screenshots and commit them as the new baselines.
Screenshots captured locally may differ from CI due to platform differences (fonts, rendering, DPI). The CI (Linux, ubuntu-latest) is the source of truth. This skill downloads the CI-produced screenshots and commits them as baselines.
gh CLI must be authenticated (gh auth status).Screenshot Tests GitHub Action must have run and produced a screenshot-diff artifact.If the user provides a specific run ID or PR number, use that. Otherwise, find the latest run:
# For a specific PR:
gh run list --workflow screenshot-test.yml --branch <branch> --limit 5 --json databaseId,status,conclusion,headBranch
# For the current branch:
gh run list --workflow screenshot-test.yml --branch $(git branch --show-current) --limit 5 --json databaseId,status,conclusion
Pick the most recent run that has a screenshot-diff artifact (runs where screenshots matched won't have one).
gh run download <run-id> --name screenshot-diff --dir .tmp/screenshot-diff
The artifact is uploaded from two paths (test/componentFixtures/.screenshots/current/ and test/componentFixtures/.screenshots/report/), but GitHub Actions strips the common prefix. So the downloaded structure is:
current/ — the CI-captured screenshots (e.g. current/baseUI/Buttons/Dark.png)report/report.json — structured diff reportreport/report.md — human-readable diff reportShow the user what changed by reading the markdown report:
cat .tmp/screenshot-diff/report/report.md
# Remove old baselines and replace with CI screenshots
rm -rf test/componentFixtures/.screenshots/baseline/
cp -r .tmp/screenshot-diff/current/ test/componentFixtures/.screenshots/baseline/
rm -rf .tmp/screenshot-diff
git add test/componentFixtures/.screenshots/baseline/
git commit -m "update screenshot baselines from CI"
Screenshot baselines are stored in Git LFS. The git lfs pre-push hook is not active in this repo (husky overwrites it), so LFS objects are NOT automatically uploaded on git push. You must push them manually before pushing the branch, otherwise the push will fail with GH008: Your push referenced unknown Git LFS objects.
git lfs push --all origin <branch-name>
git push
Confirm the baselines are updated by listing the files:
git diff --stat HEAD~1
screenshot-diff artifact exists, the screenshots already match the baselines — no update needed.--filter option on the CLI can be used to selectively accept only some fixtures if needed.Weekly Installs
182
Repository
GitHub Stars
183.0K
First Seen
Feb 22, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
cursor182
gemini-cli182
codex182
github-copilot182
amp182
kimi-cli182
Skills CLI 使用指南:AI Agent 技能包管理器安装与管理教程
33,600 周安装