create-pr
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCreate PR
创建 PR
Quick start
快速开始
- Find the template: or
.github/pull_request_template.md(case varies by repo). If none exists, fall back to a minimal Summary/Changes/Testing body — don't invent sections..github/PULL_REQUEST_TEMPLATE.md - Gather branch state: ,
git status(or the repo's default branch),git diff main...HEAD, and whether the branch is pushed/tracks a remote.git log main..HEAD - Fill in the template's sections from the actual diff and commit history — don't leave checklist items unchecked by default; check the ones genuinely true (e.g. "I verified no sensitive data is included" once you've looked).
- Title: Conventional Commits format (,
feat:,fix:,chore:,docs:,refactor:).test: - Resolve the assignee: use if set in the environment, otherwise the currently authenticated GitHub user (
$PR_ASSIGNEE). Never hardcode a specific username — this skill is shared across the team, and the assignee should default to whoever is running it.gh api user --jq .login - Create with:
assignee="${PR_ASSIGNEE:-$(gh api user --jq .login)}" gh pr create --title "<type>: <summary>" --body "$(cat <<'EOF' <filled template> EOF )" --assignee "$assignee" - If updating an existing PR instead, use (only add the assignee if not already set).
gh pr edit <number> --body "..." --add-assignee "$assignee"
-
查找模板:或
.github/pull_request_template.md(大小写因仓库而异)。如果不存在,则退回到一个最小的 Summary/Changes/Testing 正文——不要凭空编造章节。.github/PULL_REQUEST_TEMPLATE.md -
收集分支状态:、
git status(或仓库的默认分支)、git diff main...HEAD,以及分支是否已推送/跟踪远程分支。git log main..HEAD -
根据实际的 diff 和提交历史填充模板的各个章节——不要默认保留未勾选的清单项;勾选那些确实为真的项(例如,一旦你检查过,就勾选“I verified no sensitive data is included”)。
-
标题:Conventional Commits 格式(、
feat:、fix:、chore:、docs:、refactor:)。test: -
解析 assignee:如果环境中设置了,则使用该值,否则使用当前已认证的 GitHub 用户(
$PR_ASSIGNEE)。切勿硬编码特定用户名——此 skill 由团队共享,assignee 应默认为运行该 skill 的人。gh api user --jq .login -
使用以下命令创建:
assignee="${PR_ASSIGNEE:-$(gh api user --jq .login)}" gh pr create --title "<type>: <summary>" --body "$(cat <<'EOF' <filled template> EOF )" --assignee "$assignee" -
如果是更新现有 PR,改用(仅在未设置 assignee 时才添加)。
gh pr edit <number> --body "..." --add-assignee "$assignee"
Template quirks by repo
各仓库的模板特殊之处
- If a repo's or
AGENTS.mddocuments PR conventions (e.g. a Version Bump section, a required trailer, a non-standard checklist), follow those over guessing.CLAUDE.md - If a repo has no template, use a plain Summary + Changes + Test plan body — do not apply another repo's template.
-
如果仓库的或
AGENTS.md记录了 PR 约定(例如 Version Bump 章节、必需的 trailer、非标准清单),则遵循这些约定,而不是自行猜测。CLAUDE.md -
如果仓库没有模板,使用简单的 Summary + Changes + Test plan 正文——不要套用其他仓库的模板。
Related Work section
Related Work 章节
If the branch name or commits reference a work item (ADO or GitHub issue ), populate the "Related Work" / "Issue" line with it. Don't fabricate a link if none is evident.
AB#NNNNN#NNN如果分支名或提交引用了工作项(ADO 或 GitHub issue ),请在“Related Work”/“Issue”行中填充该工作项。如果没有明显的工作项,不要凭空捏造链接。
AB#NNNNN#NNNNotes
注意事项
- Always re-read the template fresh per repo/PR rather than assuming it matches a previous run — templates can drift between repos.
- 每次针对仓库/PR 都应重新阅读模板,而不是假设它与之前的运行匹配——模板在不同仓库之间可能会有差异。