gitee-pr
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGitee PR
Gitee PR
Use to execute a rules-first PR workflow.
Apply team rules from before creating PR.
scripts/create_gitee_pr.pygitee-pr-rules.md使用执行一个以规则为核心的PR工作流。在创建PR前,需应用中的团队规则。
scripts/create_gitee_pr.pygitee-pr-rules.mdRule Files
规则文件
- Main rules:
gitee-pr-rules.md
- 主规则:
gitee-pr-rules.md
Required Inputs
必填输入项
- Set Gitee token: or
GITEE_TOKEN.--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
工作流
- Resolve and
headbranches.base - Enforce branch naming format: .
member/verb-description - Ensure working tree is clean before PR (or auto-commit when is enabled).
--auto-commit - Validate all commit subjects in with allowed prefixes:
remote/base..headfeat:fix:docs:refactor:style:test:chore:
- Warn (non-blocking) when multiple core files are changed.
- Enforce Chinese PR content: title and body must include Chinese text.
- Enforce PR body template sections and order:
## 改动了什么?## 为什么改动?## 测试结果?## 注意事项
- Push branch unless .
--no-push - Create PR via Gitee API and print PR URL.
- 解析和
head分支。base - 强制分支命名格式:。
member/verb-description - 确保PR创建前工作区干净(或在启用时自动提交)。
--auto-commit - 验证范围内的所有提交标题是否使用允许的前缀:
remote/base..headfeat:fix:docs:refactor:style:test:chore:
- 当多个核心文件被修改时发出警告(不阻止流程)。
- 强制PR内容使用中文:标题和正文必须包含中文文本。
- 强制PR正文遵循指定的模板章节和顺序:
## 改动了什么?## 为什么改动?## 测试结果?## 注意事项
- 推送分支(除非使用参数)。
--no-push - 通过Gitee API创建PR并打印PR链接。
Recommended Commands
推荐命令
bash
export GITEE_TOKEN="<token>"
python3 scripts/create_gitee_pr.py \
--base main \
--title "修复:优化过滤逻辑"bash
undefinedbash
export GITEE_TOKEN="<token>"
python3 scripts/create_gitee_pr.py \
--base main \
--title "修复:优化过滤逻辑"bash
undefinedAuto-commit local changes before PR checks
自动提交本地更改后再执行PR检查
python3 scripts/create_gitee_pr.py
--auto-commit
--commit-message "chore: prepare gitee pr changes"
--base main
--auto-commit
--commit-message "chore: prepare gitee pr changes"
--base main
```bashpython3 scripts/create_gitee_pr.py
--auto-commit
--commit-message "chore: prepare gitee pr changes"
--base main
--auto-commit
--commit-message "chore: prepare gitee pr changes"
--base main
```bashValidate checks and preview generated PR body without API call
验证检查项并预览生成的PR正文,不调用API
python3 scripts/create_gitee_pr.py --base main --dry-run --no-push
```bashpython3 scripts/create_gitee_pr.py --base main --dry-run --no-push
```bashKeep custom body (must follow required template sections)
自定义PR正文(必须遵循要求的模板章节)
python3 scripts/create_gitee_pr.py
--base main
--body "$(cat pr-body.md)"
--base main
--body "$(cat pr-body.md)"
undefinedpython3 scripts/create_gitee_pr.py
--base main
--body "$(cat pr-body.md)"
--base main
--body "$(cat pr-body.md)"
undefinedDefault PR Body Template
默认PR正文模板
When is not provided, script generates:
--bodymarkdown
undefined当未提供参数时,脚本会自动生成以下内容:
--bodymarkdown
undefined改动了什么?
改动了什么?
- <commit summaries>
- <commit summaries>
为什么改动?
为什么改动?
- 请补充本次改动的业务背景和目标。
- 请补充本次改动的业务背景和目标。
测试结果?
测试结果?
- 已检查提交前工作区为干净状态。
- 请补充本地测试命令与结果。
- 已检查提交前工作区为干净状态。
- 请补充本地测试命令与结果。
注意事项
注意事项
- 无
undefined- 无
undefinedMerge 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>