gitee-pr

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Gitee PR

Gitee PR

Use
scripts/create_gitee_pr.py
to execute a rules-first PR workflow. Apply team rules from
gitee-pr-rules.md
before creating PR.
使用
scripts/create_gitee_pr.py
执行一个以规则为核心的PR工作流。在创建PR前,需应用
gitee-pr-rules.md
中的团队规则。

Rule Files

规则文件

  • Main rules:
    gitee-pr-rules.md
  • 主规则:
    gitee-pr-rules.md

Required Inputs

必填输入项

  • Set Gitee token:
    GITEE_TOKEN
    or
    --token
    .
  • Ensure remote is a Gitee repo or provide
    --repo owner/repo
    .
  • Run command inside a Git repository.
  • 设置Gitee令牌:
    GITEE_TOKEN
    或使用
    --token
    参数。
  • 确保远程仓库为Gitee仓库,或通过
    --repo owner/repo
    指定仓库。
  • 在Git仓库目录内运行命令。

Workflow

工作流

  1. Resolve
    head
    and
    base
    branches.
  2. Enforce branch naming format:
    member/verb-description
    .
  3. Ensure working tree is clean before PR (or auto-commit when
    --auto-commit
    is enabled).
  4. Validate all commit subjects in
    remote/base..head
    with allowed prefixes:
    • feat:
    • fix:
    • docs:
    • refactor:
    • style:
    • test:
    • chore:
  5. Warn (non-blocking) when multiple core files are changed.
  6. Enforce Chinese PR content: title and body must include Chinese text.
  7. Enforce PR body template sections and order:
    • ## 改动了什么?
    • ## 为什么改动?
    • ## 测试结果?
    • ## 注意事项
  8. Push branch unless
    --no-push
    .
  9. Create PR via Gitee API and print PR URL.
  1. 解析
    head
    base
    分支。
  2. 强制分支命名格式:
    member/verb-description
  3. 确保PR创建前工作区干净(或在启用
    --auto-commit
    时自动提交)。
  4. 验证
    remote/base..head
    范围内的所有提交标题是否使用允许的前缀:
    • feat:
    • fix:
    • docs:
    • refactor:
    • style:
    • test:
    • chore:
  5. 当多个核心文件被修改时发出警告(不阻止流程)。
  6. 强制PR内容使用中文:标题和正文必须包含中文文本。
  7. 强制PR正文遵循指定的模板章节和顺序:
    • ## 改动了什么?
    • ## 为什么改动?
    • ## 测试结果?
    • ## 注意事项
  8. 推送分支(除非使用
    --no-push
    参数)。
  9. 通过Gitee API创建PR并打印PR链接。

Recommended Commands

推荐命令

bash
export GITEE_TOKEN="<token>"
python3 scripts/create_gitee_pr.py \
  --base main \
  --title "修复:优化过滤逻辑"
bash
undefined
bash
export GITEE_TOKEN="<token>"
python3 scripts/create_gitee_pr.py \
  --base main \
  --title "修复:优化过滤逻辑"
bash
undefined

Auto-commit local changes before PR checks

自动提交本地更改后再执行PR检查

python3 scripts/create_gitee_pr.py
--auto-commit
--commit-message "chore: prepare gitee pr changes"
--base main

```bash
python3 scripts/create_gitee_pr.py
--auto-commit
--commit-message "chore: prepare gitee pr changes"
--base main

```bash

Validate checks and preview generated PR body without API call

验证检查项并预览生成的PR正文,不调用API

python3 scripts/create_gitee_pr.py --base main --dry-run --no-push

```bash
python3 scripts/create_gitee_pr.py --base main --dry-run --no-push

```bash

Keep custom body (must follow required template sections)

自定义PR正文(必须遵循要求的模板章节)

python3 scripts/create_gitee_pr.py
--base main
--body "$(cat pr-body.md)"
undefined
python3 scripts/create_gitee_pr.py
--base main
--body "$(cat pr-body.md)"
undefined

Default PR Body Template

默认PR正文模板

When
--body
is not provided, script generates:
markdown
undefined
当未提供
--body
参数时,脚本会自动生成以下内容:
markdown
undefined

改动了什么?

改动了什么?

  • <commit summaries>
  • <commit summaries>

为什么改动?

为什么改动?

  • 请补充本次改动的业务背景和目标。
  • 请补充本次改动的业务背景和目标。

测试结果?

测试结果?

  • 已检查提交前工作区为干净状态。
  • 请补充本地测试命令与结果。
  • 已检查提交前工作区为干净状态。
  • 请补充本地测试命令与结果。

注意事项

注意事项

undefined
undefined

Merge Cleanup

合并后清理

After PR merge, clean branch:
bash
git branch -d <branch-name>
git push origin --delete <branch-name>
PR合并后,清理分支:
bash
git branch -d <branch-name>
git push origin --delete <branch-name>