1k-create-pr

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Create OneKey App PR

创建OneKey应用PR

Automates the complete PR creation workflow for OneKey app-monorepo changes.
自动处理OneKey应用单体仓库代码变更的完整PR创建流程。

Quick Reference

快速参考

StepActionCommands
1Check status
git status
,
git branch --show-current
2Create branch (if on x)
git checkout -b <branch-name>
3Stage & commit
git add .
,
git commit -m "type: description"
4Push to remote
git push -u origin <branch-name>
5Create PR
gh pr create --base x --title "..." --body "..."
6Enable auto-merge
gh pr merge <number> --auto --squash
步骤操作命令
1检查状态
git status
,
git branch --show-current
2创建分支(若当前在x分支)
git checkout -b <branch-name>
3暂存并提交
git add .
,
git commit -m "type: description"
4推送到远程仓库
git push -u origin <branch-name>
5创建PR
gh pr create --base x --title "..." --body "..."
6启用自动合并
gh pr merge <number> --auto --squash

Workflow

工作流程

1. Check Current Branch Status

1. 检查当前分支状态

bash
git status
git branch --show-current
bash
git status
git branch --show-current

2. Branch Handling

2. 分支处理

If on
x
branch:
  • Analyze current changes (staged and unstaged)
  • Generate descriptive branch name based on changes:
    • feat/
      - new features
    • fix/
      - bug fixes
    • refactor/
      - refactoring
    • chore/
      - maintenance tasks
  • Create and switch:
    git checkout -b <branch-name>
If already on feature branch: Skip branch creation
若当前位于
x
分支:
  • 分析当前变更(已暂存和未暂存的内容)
  • 根据变更生成描述性分支名称:
    • feat/
      - 新功能
    • fix/
      - 漏洞修复
    • refactor/
      - 代码重构
    • chore/
      - 维护任务
  • 创建并切换分支:
    git checkout -b <branch-name>
若已在功能分支上: 跳过分支创建步骤

3. Stage and Commit Changes

3. 暂存并提交变更

bash
git add .
git commit -m "<type>: <description>"
Commit format:
  • Follow conventional commits
  • Do NOT add Claude signatures or Co-Authored-By
bash
git add .
git commit -m "<type>: <description>"
提交格式要求:
  • 遵循约定式提交规范
  • 请勿添加Claude签名或Co-Authored-By信息

4. Push to Remote

4. 推送到远程仓库

bash
git push -u origin <branch-name>
bash
git push -u origin <branch-name>

5. Create Pull Request

5. 创建Pull Request

bash
gh pr create --base x --title "<title>" --body "<description>"
Issue ID handling:
  • Extract
    OK-{number}
    from commit summary/description
  • Append to PR title:
    fix: description(OK-49185)
  • No space before opening parenthesis
bash
gh pr create --base x --title "<title>" --body "<description>"
Issue ID处理规则:
  • 从提交摘要/描述中提取
    OK-{number}
    格式的Issue ID
  • 将其追加到PR标题末尾:
    fix: description(OK-49185)
  • 左括号前无空格

6. Enable Auto-Merge

6. 启用自动合并

bash
gh pr update-branch <PR_NUMBER>
gh pr merge <PR_NUMBER> --auto --squash
bash
gh pr update-branch <PR_NUMBER>
gh pr merge <PR_NUMBER> --auto --squash

7. Return PR URL

7. 返回PR链接

Display PR URL to user and optionally open in browser:
bash
open <PR_URL>
向用户展示PR链接,可选择在浏览器中打开:
bash
open <PR_URL>

Important Notes

重要注意事项

  • Always target
    x
    as base branch
  • Use conventional commit format:
    type: description
  • Extract and append issue IDs (OK-{number}) to PR title
  • 始终以
    x
    分支为目标基准分支
  • 使用约定式提交格式:
    type: description
  • 提取并将Issue ID(OK-{number})追加到PR标题中