pr

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Pull Request

Pull Request

Create pull requests with proper templates and metadata.
使用规范的模板和元数据创建Pull Request。

Requirements

要求

  • PR should use the PR template of the current repository
  • Assignee is automatically set by CI (random CODEOWNER)
  • Labels are automatically applied by CI based on changed files
  • PR 需使用当前仓库的PR模板
  • 负责人由CI自动设置(随机选择CODEOWNER)
  • CI会根据变更的文件自动添加标签

Issue Detection

关联问题检测

If the branch name contains an issue number (e.g.,
feat/123-add-feature
,
fix/45-parser-crash
), extract it and fetch the issue details:
bash
gh issue view <number> --json title,body,labels
Use the issue context to:
  1. Link the issue using the Closes section format (see below)
  2. Inform the PR summary and description from the issue's title and body
If no issue number is found in the branch name, skip this step.
如果分支名称包含问题编号(例如:
feat/123-add-feature
fix/45-parser-crash
),请提取该编号并获取问题详情:
bash
gh issue view <number> --json title,body,labels
利用问题上下文完成以下操作:
  1. 使用Closes章节格式关联问题(见下文)
  2. 根据问题的标题和内容完善PR的摘要和描述
如果分支名称中未找到问题编号,则跳过此步骤。

Issue Link Format

问题关联格式

Always use this exact format when linking issues in a PR body. Replace the repo's
## Related Issues
template section with a
## Closes
section:
markdown
undefined
在PR正文中关联问题时,请务必使用以下格式。将仓库模板中的
## Related Issues
章节替换为
## Closes
章节:
markdown
undefined

Closes

Closes

  • Closes #123
  • Closes #456
  • Relates to #789

This format ensures GitHub renders rich issue links (with title, status, etc.)
automatically. Do **not** append the issue title after the number — GitHub
handles that via its rich formatting.

Rules:

- Use a `## Closes` heading (not `## Related Issues`)
- Each link is a bullet point: `- Closes #<number>`
- Use `Relates to` instead of `Closes` for issues that are related but not
  fully resolved by this PR
- Do **not** add any text after the issue number (no titles, no descriptions)
  • Closes #123
  • Closes #456
  • Relates to #789

此格式可确保GitHub自动渲染富文本问题链接(包含标题、状态等信息)。**请勿**在编号后附加问题标题——GitHub会通过富文本格式自动处理。

规则:

- 使用`## Closes`标题(而非`## Related Issues`)
- 每个链接为项目符号:`- Closes #<number>`
- 对于相关但未被PR完全解决的问题,使用`Relates to`替代`Closes`
- **请勿**在问题编号后添加任何文本(无标题、无描述)

Usage

使用方法

When asked to create a PR:
  1. Ensure pre-commit checks pass (lint, test, Docker if applicable)
  2. Push the branch to remote
  3. Detect associated issue from branch name (see above)
  4. Read the repo's PR template: look for
    .github/PULL_REQUEST_TEMPLATE.md
  5. Fill in the PR template with actual content:
    • Summary: Concise description of what the PR does and why
    • Type: Check the matching type checkbox (feat, fix, test, etc.)
    • Changes Made: Bullet list of specific changes
    • Closes: Replace
      ## Related Issues
      with
      ## Closes
      section using the issue link format specified above
    • Testing: Check boxes for tests that were added/run
    • Quality Checks: Check boxes for lint/format/build that passed
    • Checklist: Check all applicable items
    • Leave sections like Breaking Changes, Screenshots, Deployment Notes with their placeholder comments if not applicable
  6. Create the PR:
    bash
    gh pr create --title "<title>" --body "<filled template>"
    Use a HEREDOC for the body to preserve formatting.
Important: Do NOT use
gh pr create --fill
— it only uses the commit message and skips the PR template entirely. Always read and fill the template.
Note: Assignees and labels are handled automatically by GitHub Actions:
  • pr-auto-assign.yml
    - Assigns a random CODEOWNER
  • pr-labeler.yml
    - Labels based on changed files (see
    .github/labeler.yml
    )
当需要创建PR时:
  1. 确保预提交检查通过(代码检查、测试、Docker<如果适用>)
  2. 将分支推送到远程仓库
  3. 从分支名称中检测关联问题(见上文)
  4. 阅读仓库的PR模板:查找
    .github/PULL_REQUEST_TEMPLATE.md
    文件
  5. 填写PR模板并补充实际内容:
    • 摘要:简洁描述PR的功能和目的
    • 类型:勾选匹配的类型复选框(feat、fix、test等)
    • 变更内容:列出具体变更的项目符号
    • Closes:将
      ## Related Issues
      替换为
      ## Closes
      章节,并使用上述指定的问题关联格式
    • 测试:勾选已添加/执行的测试对应的复选框
    • 质量检查:勾选已通过的代码检查/格式化/构建对应的复选框
    • 检查清单:勾选所有适用的项
    • 如果不适用,保留诸如Breaking Changes、Screenshots、Deployment Notes等章节的占位符注释
  6. 创建PR
    bash
    gh pr create --title "<title>" --body "<filled template>"
    使用HEREDOC来保留正文格式。
重要提示:请勿使用
gh pr create --fill
——该命令仅使用提交信息,完全跳过PR模板。请务必阅读并填写模板。
注意:负责人和标签由GitHub Actions自动处理:
  • pr-auto-assign.yml
    - 随机分配一位CODEOWNER
  • pr-labeler.yml
    - 根据变更的文件添加标签(详见
    .github/labeler.yml

Checklist

检查清单

Before creating PR:
  • All linting passes
  • All tests pass
  • Branch is pushed to remote
  • Associated issue detected and linked (if branch has issue number)
  • PR template read and filled with actual content
  • PR created with filled template (not
    --fill
    )
创建PR前:
  • 所有代码检查已通过
  • 所有测试已通过
  • 分支已推送到远程仓库
  • 已检测并关联相关问题(如果分支包含问题编号)
  • 已阅读PR模板并填写实际内容
  • 使用填写好的模板创建PR(未使用
    --fill