nemoclaw-contributor-create-pr
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCreate GitHub Pull Request
创建GitHub拉取请求(PR)
Create pull requests on the NemoClaw GitHub repository using the CLI. This skill ensures every PR follows the project's PR template exactly.
gh使用 CLI在NemoClaw GitHub仓库创建拉取请求。此技能确保每个PR严格遵循项目的PR模板。
ghPrerequisites
前置条件
- The CLI must be authenticated (
gh).gh auth status - You must be in the NemoClaw git repository.
- You must have commits on a branch that is pushed to the remote.
- 必须已完成CLI的身份验证(执行
gh验证)。gh auth status - 你必须处于NemoClaw git仓库目录中。
- 你所在的分支必须有已推送到远程仓库的提交记录。
Step 1: Verify Branch State
步骤1:验证分支状态
Before creating a PR, verify the branch.
-
Not on main. Never create PRs from main.bash
git branch --show-current -
Branch has commits ahead of main.bash
git log main..HEAD --oneline -
Working tree is clean. Stage or stash any uncommitted changes first.bash
git status
创建PR前,请验证分支状态。
-
不在main分支。切勿从main分支创建PR。bash
git branch --show-current -
分支存在超前于main的提交。bash
git log main..HEAD --oneline -
工作区干净。请先暂存或储藏所有未提交的变更。bash
git status
Step 2: Run Pre-PR Checks
步骤2:运行PR前置检查
Choose checks based on the files changed.
For code changes, run both checks and confirm they pass before proceeding:
bash
npx prek run --all-files
npm testFor doc-only changes, do not run the full test suite unless the docs change requires it.
Run the docs and hook checks instead:
bash
npx prek run --all-files
make docsIf a required check fails, fix the issue before creating the PR.
When preparing the PR body for a doc-only change, leave the verification box unchecked unless you actually ran it.
npm test根据变更的文件选择对应的检查项。
对于代码变更,需运行以下两项检查并确认通过后再继续:
bash
npx prek run --all-files
npm test对于仅文档变更,除非文档变更有特殊要求,否则无需运行完整测试套件。只需运行文档和钩子检查:
bash
npx prek run --all-files
make docs如果某项必填检查未通过,请先修复问题再创建PR。当为仅文档变更准备PR正文时,若未实际运行,请保留该项验证框为未勾选状态。
npm testStep 3: Push the Branch
步骤3:推送分支
Ensure the branch is pushed to the remote.
bash
git push -u origin HEAD确保分支已推送到远程仓库。
bash
git push -u origin HEADStep 4: Determine PR Metadata
步骤4:确定PR元数据
Title
标题
PR titles must follow Conventional Commits format:
text
<type>(<scope>): <description>Types: , , , , , , ,
featfixdocschorerefactortestciperfScope is typically the component name (e.g., , , , , ).
cliblueprintpluginpolicydocsExamples:
feat(cli): add offline mode for onboardingfix(blueprint): prevent SSRF bypass via redirectdocs: update quickstart for Windows prerequisites
PR标题必须遵循Conventional Commits格式:
text
<type>(<scope>): <description>类型包括:、、、、、、、
featfixdocschorerefactortestciperf范围通常为组件名称(例如:、、、、)。
cliblueprintpluginpolicydocs示例:
feat(cli): add offline mode for onboardingfix(blueprint): prevent SSRF bypass via redirectdocs: update quickstart for Windows prerequisites
Type of Change
变更类型
Determine which type applies based on the diff:
- Code change for a new feature, bug fix, or refactor — most PRs.
- Code change with doc updates — code plus changes under .
docs/ - Doc only, prose changes without code sample modifications — only Markdown prose.
- Doc only, includes code sample changes — doc changes that modify fenced code blocks.
根据代码差异确定适用的变更类型:
- 代码变更(新功能、Bug修复或重构) —— 大多数PR属于此类。
- 代码变更并包含文档更新 —— 代码变更加上目录下的修改。
docs/ - 仅文档变更,仅修改 prose 内容未改动代码示例 —— 仅修改Markdown文本内容。
- 仅文档变更,包含代码示例修改 —— 文档变更涉及修改 fenced code blocks(代码块)。
Related Issue
关联Issue
Check the branch name and commit messages for issue references. If an issue exists, use or .
Fixes #NNNCloses #NNN查看分支名称和提交信息中的Issue引用。若存在关联Issue,请使用或格式。
Fixes #NNNCloses #NNNDCO Sign-Off
DCO签署
The PR body must include a DCO sign-off line. Determine the user's name and email from git config:
bash
git config user.name
git config user.emailPR正文必须包含DCO签署行。从git配置中获取用户名和邮箱:
bash
git config user.name
git config user.emailStep 5: Compose the PR Body
步骤5:撰写PR正文
Use the exact template structure below. Fill in each section based on the diff (). Check the applicable boxes and leave others unchecked. Do not add, remove, or reorganize sections.
git diff main...HEADmarkdown
undefined使用以下精确的模板结构。根据代码差异()填写每个部分。勾选适用的选项框,其余保持未勾选状态。请勿添加、删除或重新组织任何章节。
git diff main...HEADmarkdown
undefinedSummary
摘要
<!-- 1-3 sentences: what this PR does and why. -->
<!-- 1-3句话:说明此PR的功能及实现原因。 -->
Related Issue
关联Issue
<!-- Fixes #NNN or Closes #NNN. Remove this section if none. -->
<!-- 格式为Fixes #NNN或Closes #NNN。若无关联Issue请删除此章节。 -->
Changes
变更内容
<!-- Bullet list of key changes. -->
<!-- 列出关键变更的项目符号列表。 -->
Type of Change
变更类型
- Code change (feature, bug fix, or refactor)
- Code change with doc updates
- Doc only (prose changes, no code sample modifications)
- Doc only (includes code sample changes)
- 代码变更(新功能、Bug修复或重构)
- 代码变更并包含文档更新
- 仅文档变更(仅修改文本内容,未改动代码示例)
- 仅文档变更(包含代码示例修改)
Verification
验证项
<!-- Check each item you ran and confirmed. Leave unchecked items you skipped. Doc-only changes do not require npm test unless you ran it. -->
<!-- DCO sign-off required by CI. Run: git config user.name && git config user.email -->
- passes
npx prek run --all-files - passes
npm test - Tests added or updated for new or changed behavior
- No secrets, API keys, or credentials committed
- Docs updated for user-facing behavior changes
- builds without warnings (doc changes only)
make docs - Doc pages follow the style guide (doc changes only)
- New doc pages include SPDX header and frontmatter (new pages only)
<!-- DCO sign-off required by CI. Run: git config user.name && git config user.email -->
Signed-off-by: {name} <{email}>
undefined<!-- 勾选你实际运行并确认通过的项。未运行的项请保持未勾选状态。仅文档变更无需运行npm test,除非你实际执行了该命令。 -->
<!-- CI要求必须包含DCO签署。执行命令:git config user.name && git config user.email -->
- 执行通过
npx prek run --all-files - 执行通过
npm test - 为新增或变更的行为添加或更新了测试用例
- 未提交任何密钥、API密钥或凭证信息
- 针对面向用户的行为变更更新了文档
- 构建无警告(仅文档变更时需验证)
make docs - 文档页面遵循风格指南(仅文档变更时需验证)
- 新增文档页面包含SPDX头部和前置元数据(仅新增页面时需验证)
<!-- CI要求必须包含DCO签署。执行命令:git config user.name && git config user.email -->
Signed-off-by: {name} <{email}>
undefinedPopulating the Template
填充模板规则
Follow these rules when filling in the template:
- Summary: Write 1-3 sentences describing what the PR does and why. Derive this from the commit messages and diff, not from generic descriptions.
- Related Issue: Include or
Fixes #NNNif an issue exists. Remove the section entirely if there is no related issue.Closes #NNN - Changes: Bullet list of key changes. Be specific — reference file names, commands, or behaviors that changed.
- Type of Change: Check exactly one box. Use for checked,
[x]for unchecked.[ ] - Verification: Check only the boxes for steps you actually ran and confirmed passing. Do not check boxes for steps you skipped or did not verify. For doc-only changes, is not required; leave it unchecked unless you ran it.
npm test - DCO Sign-Off: Replace and
{name}with values from{email}andgit config user.name.git config user.email
填充模板时请遵循以下规则:
- 摘要:撰写1-3句话说明此PR的功能及实现原因。内容需来自提交信息和代码差异,而非通用描述。
- 关联Issue:若存在关联Issue,添加或
Fixes #NNN格式内容。若无关联Issue,请完全删除该章节。Closes #NNN - 变更内容:列出关键变更的项目符号列表。需具体明确——引用变更的文件名、命令或行为。
- 变更类型:仅勾选一个选项框。使用表示已勾选,
[x]表示未勾选。[ ] - 验证项:仅勾选你实际运行并确认通过的项。请勿勾选未运行或未验证的项。对于仅文档变更,并非必填项;除非你实际执行了该命令,否则请保持未勾选状态。
npm test - DCO签署:将和
{name}替换为{email}和git config user.name输出的内容。git config user.email
Step 6: Create the PR
步骤6:创建PR
Use with the flag and a HEREDOC for the body to preserve formatting.
gh pr create--assignee @mebash
gh pr create \
--title "<type>(<scope>): <description>" \
--assignee "@me" \
--body "$(cat <<'EOF'
<full PR body from Step 5>
EOF
)"使用命令,添加参数,并通过HEREDOC传入正文以保留格式。
gh pr create--assignee @mebash
gh pr create \
--title "<type>(<scope>): <description>" \
--assignee "@me" \
--body "$(cat <<'EOF'
<步骤5中撰写的完整PR正文>
EOF
)"Labels
标签
Add labels when applicable:
bash
--label "documentation" # for doc-only or doc-inclusive PRs
--label "topic:security" # for security-related changes适当时添加标签:
bash
--label "documentation" # 适用于仅文档变更或包含文档变更的PR
--label "topic:security" # 适用于安全相关变更Draft PRs
草稿PR
For work-in-progress that is not ready for review:
bash
gh pr create --draft --title "..." --assignee "@me" --body "..."对于尚未准备好审核的进行中工作:
bash
gh pr create --draft --title "..." --assignee "@me" --body "..."Step 7: Report the Result
步骤7:反馈结果
After the PR is created, display the PR URL as a clickable markdown link:
text
Created PR [#NNN](https://github.com/NVIDIA/NemoClaw/pull/NNN)PR创建完成后,以可点击的Markdown链接形式展示PR URL:
text
已创建PR [#NNN](https://github.com/NVIDIA/NemoClaw/pull/NNN)Common Mistakes to Avoid
需避免的常见错误
- Do not invent your own PR body format. Use the template from Step 5 exactly.
- Do not omit sections. Even if a section is not applicable, keep it with the "Skip if..." comment.
- Do not check boxes for steps you did not run. If you did not run , leave that box unchecked.
make docs - Do not run the full test suite for doc-only changes by default. Run docs and hook checks instead, and leave unchecked unless you actually ran it.
npm test - Do not forget the DCO sign-off. CI will reject the PR without it.
- Do not forget . Every PR must be assigned to its creator.
--assignee @me - Do not create PRs from main. Always use a feature branch.
- 请勿自行设计PR正文格式。严格使用步骤5中的模板。
- 请勿省略章节。即使某章节不适用,也请保留其“若无需...”的注释内容。
- 请勿勾选未运行的步骤对应的选项框。若未运行,请保持该选项框为未勾选状态。
make docs - 默认情况下,请勿为仅文档变更运行完整测试套件。请改为运行文档和钩子检查,且若未实际运行,请保持该项未勾选。
npm test - 请勿忘记DCO签署。若无DCO签署,CI将拒绝该PR。
- 请勿忘记添加。每个PR必须分配给创建者本人。
--assignee @me - 请勿从main分支创建PR。请始终使用功能分支。