AGENT SKILL
PR 本地单元测试修复
github.get_pr_to_pass_local_tests
使当前 PR 的本地单元测试全部通过。
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-02
- Stars
- ★ 155
- Forks
- 170
01 前言 Front Matter
- model
- sonnet
- description
- Make the local unit tests pass for the current PR
03 SKILL.md 正文
Goal
- Run, monitor, and fix the local unit tests for the current PR
Workflow
Create and Update a Plan
- Create a file
plan-github.get_pr_to_pass_local_tests.mdwith a plan in the form of a bullet list of actions and maintain it updated, by marking each action- [.] when something is in progress
- [x] when something is done
- [F] when something failed
Get the PR Number and Branch Name
-
Get the PR number
> GH_PR_NUM=$(gh pr view --json number -q .number) -
Get the branch name
> BRANCH_NAME=$(git branch --show-current)
Run Local Regressions
- Run full test suite locally:
> pytest_multi_build.py --target . 2>&1 --timeout -1 | tee tmp.auto_task.pytest_multi_build.log - Wait for the script to terminate
Check Regressions to Complete
- Check the output of the local regressions with:
> pytest_failed_multi_build.py 2>&1 | tee tmp.auto_task.pytest_failed_multi_build.log
Report Status on the PR
- If local regressions are passing:
> gh pr comment $GH_PR_NUM --body "Local tests passing" - If any failures, document error and post:
> gh pr comment $GH_PR_NUM --body "Local test failures found: [error summary]. Investigating..."
Fix the Failures
- If failures were found, run
tmp.pytest_failed_multi_build.repro.shto understand what failed and use/pytest.fix_local_teststo analyze and fix them- If the fix is simple, just fix it and commit
- If the fix is not clear, stop and ask for the user to help
Never Commit Junk Files
- Never run
git add -Aorgit add .to stage a fix: it sweeps in every untracked file sitting in the working tree (logs,tmp.*scratch files, test-run artifacts like.pkl/.jsoncaches, etc.), not just the files you intended to fix - Always stage files explicitly by path, e.g.
git add <file1> <file2> - Before committing, run
git status --shortand review every listed file; drop anything that is not part of the intended fix - If junk files were already committed and pushed, fix it by amending the
commit to contain only the intended files and force-pushing
(
git push --force-with-lease), rather than leaving the junk in history
Loop
- Keep repeating until the PR is passing all the local tests
Constraints
- This skill runs both when executed locally on a dev computer and remotely on cloud (e.g., on GitHub or Anthropic infrastructure)
Verification
- [ ]
pytest_failed_multi_build.pyreports no failing tests - [ ] A PR comment reports the final local test status
- [ ]
git status --shortshows only the intended files staged before commit
04 同仓库更多 Skills
Docker 文件同步与模板对齐
tutorial_in_60_mins.propagate_docker_changes
同步教程和课程项目的 Docker 文件,使其与 project_template 保持一致。
★ 155
Markdown 合并至 Jupyter Notebook
tutorial_in_60_mins.merge_markdown
将 Markdown 文件的内容合并到 Jupyter Notebook 中。
★ 155
60 分钟教程格式规范化
tutorial_in_60_mins.format
格式化目录,使其遵循「Learn X in 60 Minutes」(60 分钟学会 X)教程约定。
★ 155
60 分钟教程目录创建
tutorial_in_60_mins.create
按照「Learn X in 60 Minutes」(60 分钟学会 X)约定创建教程目录。
★ 155
todo.reorg_in_progress
Reorganize ai_task_queue.md so in-progress tasks, not-started tasks, and mislabeled topic headers sit under the right H1 stage
★ 155
todo.reorg_headers
Reorganize ai_task_queue.md .md so every H2 topic matches ALL TOPICS and every H3 task sits under the right topic, keeping its H1 stage
★ 155