process-pr

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Process PR

PR处理流程

A comprehensive workflow skill that orchestrates the complete pull request lifecycle from initial review through merge.
一款全面的工作流技能,可编排从初始审核到合并的完整拉取请求生命周期。

Purpose

用途

Provides end-to-end automation for processing PRs, composing multiple workflow and tool skills into a unified, efficient process.
为PR处理提供端到端自动化能力,将多个工作流和工具技能组合成一个统一、高效的流程。

When to Use

适用场景

Use this workflow when:
  • You want complete PR automation from start to finish
  • PR is ready for final processing and merge
  • You need a consistent, repeatable PR workflow
  • Multiple PRs need to be processed efficiently
在以下场景使用此工作流:
  • 你需要从开始到结束的完整PR自动化流程
  • PR已准备好进行最终处理和合并
  • 你需要一致、可重复的PR工作流
  • 需要高效处理多个PR

Skill Composition

技能组件

This workflow composes:
  1. pull-request-tool: PR interaction and status checking
  2. parallel-execution: Concurrent checks and analyses
  3. sequential-execution: Ordered workflow stages
  4. resolve-pr-comments: Address review feedback
  5. merge-pr: Safe merge execution
  6. yolo OR collaborative: Execution mode
此工作流由以下组件构成:
  1. pull-request-tool: PR交互与状态检查
  2. parallel-execution: 并发检查与分析
  3. sequential-execution: 有序工作流阶段
  4. resolve-pr-comments: 处理审核反馈
  5. merge-pr: 安全合并执行
  6. yolocollaborative: 执行模式

Parameters

参数

Required

必填参数

  • pr-number: Pull request number(s) to process
  • repository: Repository in format
    owner/repo
  • pr-number: 待处理的拉取请求编号(单个或多个)
  • repository: 仓库(格式为
    owner/repo

Optional

可选参数

  • interaction-mode:
    yolo
    (autonomous) or
    collaborative
    (interactive)
  • merge-method:
    merge
    ,
    squash
    (default), or
    rebase
  • delete-branch: Delete branch after merge (default: true)
  • run-local-checks: Run tests/lint locally before merge (default: true)
  • resolve-comments: Auto-resolve review comments (default: true)
  • require-approvals: Minimum required approvals (default: 1)
  • interaction-mode:
    yolo
    (自主式)或
    collaborative
    (交互式)
  • merge-method:
    merge
    squash
    (默认)或
    rebase
  • delete-branch: 合并后删除分支(默认:true)
  • run-local-checks: 合并前在本地运行测试/代码检查(默认:true)
  • resolve-comments: 自动处理审核评论(默认:true)
  • require-approvals: 最低所需审核通过数(默认:1)

Workflow Stages

工作流阶段

Stage 1: Initial Assessment (Parallel)

阶段1:初始评估(并行执行)

Execute these checks simultaneously for speed:
  1. Fetch PR details (pull-request-tool)
    • Get PR metadata, status, labels
    • Identify base and head branches
  2. Check review status (pull-request-tool)
    • Count approvals
    • Check for blocking reviews
    • List unresolved threads
  3. Verify CI checks (pull-request-tool)
    • Get status check results
    • Identify failing/pending checks
Result: Comprehensive PR readiness snapshot
为提升速度,同时执行以下检查:
  1. 获取PR详情(pull-request-tool)
    • 获取PR元数据、状态、标签
    • 识别基准分支和头部分支
  2. 检查审核状态(pull-request-tool)
    • 统计审核通过数
    • 检查是否存在阻塞性审核
    • 列出未解决的讨论线程
  3. 验证CI检查结果(pull-request-tool)
    • 获取状态检查结果
    • 识别失败/待处理的检查项
结果:生成全面的PR就绪状态快照

Stage 2: Local Verification (Sequential)

阶段2:本地验证(串行执行)

If
run-local-checks = true
:
  1. Fetch branch
    • Checkout PR branch
    • Pull latest changes
  2. Run tests (parallel)
    • Unit tests
    • Integration tests
    • Linter
    • Type checker
  3. Verify build
    • Compile/build project
    • Check for build errors
如果
run-local-checks = true
  1. 拉取分支
    • 检出PR分支
    • 拉取最新变更
  2. 运行测试(并行执行)
    • 单元测试
    • 集成测试
    • 代码检查
    • 类型检查
  3. 验证构建
    • 编译/构建项目
    • 检查是否存在构建错误

Stage 3: Address Feedback (Sequential)

阶段3:处理反馈(串行执行)

If unresolved comments exist and
resolve-comments = true
:
  1. Invoke resolve-pr-comments workflow
    • Uses interaction mode (yolo or collaborative)
    • Addresses all review feedback
    • Resolves threads
  2. Push changes
    • Commit fixes
    • Push to PR branch
    • Trigger CI re-run
  3. Wait for checks
    • Monitor CI status
    • Wait for all checks to complete
如果存在未解决的评论且
resolve-comments = true
  1. 调用resolve-pr-comments工作流
    • 使用指定的交互模式(yolo或collaborative)
    • 处理所有审核反馈
    • 解决讨论线程
  2. 推送变更
    • 提交修复内容
    • 推送到PR分支
    • 触发CI重新运行
  3. 等待检查完成
    • 监控CI状态
    • 等待所有检查完成

Stage 4: Final Verification (Parallel)

阶段4:最终验证(并行执行)

Before merge, verify in parallel:
  1. Confirm approvals
    • Required approvals met
    • No blocking reviews
  2. Confirm checks
    • All status checks pass
    • No failing required checks
  3. Confirm mergeable
    • No conflicts
    • Branch up to date
合并前,并行执行以下验证:
  1. 确认审核通过
    • 满足最低所需审核数
    • 无阻塞性审核
  2. 确认检查通过
    • 所有状态检查通过
    • 无失败的必填检查项
  3. 确认可合并
    • 无合并冲突
    • 分支已同步最新内容

Stage 5: Merge (Sequential)

阶段5:合并(串行执行)

  1. Invoke merge-pr workflow
    • Uses interaction mode (yolo or collaborative)
    • Executes safe merge
    • Deletes branch if requested
  2. Verify merge
    • Confirm PR merged
    • Verify commit in main
    • Check branch deleted
  1. 调用merge-pr工作流
    • 使用指定的交互模式(yolo或collaborative)
    • 执行安全合并
    • 按要求删除分支
  2. 验证合并结果
    • 确认PR已合并
    • 验证提交已同步到主分支
    • 检查分支是否已删除

Stage 6: Post-Merge (Optional)

阶段6:合并后操作(可选)

  1. Update local repo
    • Pull main branch
    • Clean up local references
  2. Notify stakeholders
    • Post completion message
    • Tag related issues
    • Update project boards
  1. 更新本地仓库
    • 拉取主分支
    • 清理本地引用
  2. 通知相关人员
    • 发送完成通知
    • 关联相关议题
    • 更新项目看板

Interaction Modes

交互模式

YOLO Mode (Fully Autonomous)

YOLO模式(完全自主)

markdown
When interaction-mode = yolo:
- Complete entire workflow without confirmation
- Make all decisions automatically
- Auto-resolve issues where possible
- Report only final summary
Example:
markdown
User: "Process PR #42 in YOLO mode"

Agent executes full workflow:
1. Fetches PR, checks status (parallel)
2. Runs local tests (parallel)
3. Addresses 3 review comments
4. Resolves threads
5. Pushes fixes
6. Waits for CI (all pass)
7. Verifies approvals (2 found)
8. Merges PR (squash)
9. Deletes branch

Reports: "PR #42 processed and merged. Addressed 3 comments, all checks pass, merged to main."
markdown
When interaction-mode = yolo:
- Complete entire workflow without confirmation
- Make all decisions automatically
- Auto-resolve issues where possible
- Report only final summary
示例:
markdown
用户:"以YOLO模式处理PR #42"

Agent执行完整工作流:
1. 拉取PR,检查状态(并行)
2. 运行本地测试(并行)
3. 处理3条审核评论
4. 解决讨论线程
5. 推送修复内容
6. 等待CI完成(全部通过)
7. 验证审核通过数(找到2个)
8. 合并PR(squash模式)
9. 删除分支

报告:"PR #42已处理并合并。已处理3条评论,所有检查通过,已合并到主分支。"

Collaborative Mode (Interactive)

协作模式(交互式)

markdown
When interaction-mode = collaborative:
- Show progress at each stage
- Request confirmation for major decisions
- Present issues for user guidance
- Allow intervention at checkpoints
Example:
markdown
User: "Process PR #42"

Agent: "Starting PR #42 processing...

Stage 1: Initial Assessment
✅ PR details fetched
✅ Reviews: 2 approvals
⚠️  Unresolved comments: 3

Should I proceed to address the comments? (yes/no/show)"

User: "show"

[Shows 3 comments]

User: "yes"

Agent: "Addressing comments...
✅ Comment 1: Added error handling
✅ Comment 2: Fixed typo
✅ Comment 3: Clarified with reply

Pushing changes and waiting for CI..."

[CI completes]

Agent: "All checks pass. Ready to merge.
Method: Squash and merge
Delete branch: Yes

Proceed? (yes/no)"

User: "yes"

Agent: "✅ PR #42 merged successfully"
markdown
When interaction-mode = collaborative:
- Show progress at each stage
- Request confirmation for major decisions
- Present issues for user guidance
- Allow intervention at checkpoints
示例:
markdown
用户:"处理PR #42"

Agent:"开始处理PR #42...

阶段1:初始评估
✅ PR详情已获取
✅ 审核状态:2个通过
⚠️ 未解决评论:3条

是否继续处理这些评论?(是/否/查看)"

用户:"查看"

[显示3条评论]

用户:"是"

Agent:"正在处理评论...
✅ 评论1:已添加错误处理
✅ 评论2:已修复拼写错误
✅ 评论3:已回复澄清

正在推送变更并等待CI完成..."

[CI完成]

Agent:"所有检查通过。准备合并。
合并方式:Squash合并
删除分支:是

是否继续?(是/否)"

用户:"是"

Agent:"✅ PR #42已成功合并"

Optimization Strategies

优化策略

Parallel Execution

并行执行

Where possible, execute independently:
  • Initial assessment (PR fetch + reviews + checks)
  • Local verification (tests + linter + build)
  • Final verification (approvals + checks + mergeable)
Benefits: 3-5x faster than sequential
在独立的任务中尽可能使用并行:
  • 初始评估(PR拉取 + 审核状态 + CI检查)
  • 本地验证(测试 + 代码检查 + 构建)
  • 最终验证(审核通过 + 检查通过 + 可合并性)
优势:比串行执行快3-5倍

Sequential Execution

串行执行

Where order matters:
  • Address comments → Push changes → Wait for CI
  • Verify readiness → Merge → Verify completion
  • Each stage depends on previous success
在有顺序依赖的任务中使用串行:
  • 处理评论 → 推送变更 → 等待CI
  • 验证就绪状态 → 合并 → 验证完成
  • 每个阶段依赖前一阶段的成功

Mixed Approach

混合方式

Combine for optimal speed:
markdown
Stage 1: Parallel assessment
Stage 2: Sequential local checks
Stage 3: Sequential comment resolution
Stage 4: Parallel final verification
Stage 5: Sequential merge
结合两种方式以实现最优速度:
markdown
Stage 1: Parallel assessment
Stage 2: Sequential local checks
Stage 3: Sequential comment resolution
Stage 4: Parallel final verification
Stage 5: Sequential merge

Error Handling

错误处理

Common Issues

常见问题

  1. Failing CI checks
    • YOLO: Wait for checks to pass or report blocker
    • Collaborative: Show failures, ask to investigate or wait
    • Auto-retry if transient
  2. Unresolved comments
    • YOLO: Auto-resolve if trivial, otherwise address
    • Collaborative: Show comments, get approval for resolution
    • Invoke resolve-pr-comments workflow
  3. Merge conflicts
    • YOLO: Report blocker (cannot auto-resolve conflicts)
    • Collaborative: Suggest resolution strategies
    • Requires manual intervention
  4. Missing approvals
    • YOLO: Report blocker, cannot proceed
    • Collaborative: Show who can approve, ask to request
    • Wait for approvals
  5. Local test failures
    • YOLO: Investigate and fix if possible
    • Collaborative: Show failures, ask for guidance
    • May skip if only remote checks required
  1. CI检查失败
    • YOLO模式:等待检查通过或报告阻塞
    • 协作模式:显示失败项,询问是否调查或等待
    • 针对临时错误自动重试
  2. 未解决评论
    • YOLO模式:自动解决简单问题,否则处理复杂问题
    • 协作模式:显示评论,获取用户处理许可
    • 调用resolve-pr-comments工作流
  3. 合并冲突
    • YOLO模式:报告阻塞(无法自动解决冲突)
    • 协作模式:建议解决策略
    • 需要人工干预
  4. 缺少审核通过
    • YOLO模式:报告阻塞,无法继续
    • 协作模式:显示可审核人员,询问是否发起请求
    • 等待审核通过
  5. 本地测试失败
    • YOLO模式:尽可能调查并修复
    • 协作模式:显示失败项,寻求用户指导
    • 若仅需远程检查可跳过

Workflow Variations

工作流变体

Quick Merge (Minimal Checks)

快速合并(最小检查)

For low-risk PRs:
markdown
Parameters:
  run-local-checks: false
  resolve-comments: false (assume resolved)
  
Workflow:
1. Verify CI and approvals
2. Merge immediately
适用于低风险PR:
markdown
Parameters:
  run-local-checks: false
  resolve-comments: false (assume resolved)
  
Workflow:
1. Verify CI and approvals
2. Merge immediately

Thorough Review (All Checks)

全面审核(全量检查)

For high-risk PRs:
markdown
Parameters:
  run-local-checks: true
  resolve-comments: true
  interaction-mode: collaborative
  
Workflow:
1. Full local verification
2. Interactive comment resolution
3. Manual merge confirmation
适用于高风险PR:
markdown
Parameters:
  run-local-checks: true
  resolve-comments: true
  interaction-mode: collaborative
  
Workflow:
1. Full local verification
2. Interactive comment resolution
3. Manual merge confirmation

Batch Processing (Multiple PRs)

批量处理(多个PR)

For processing many PRs:
markdown
Parameters:
  pr-number: [42, 43, 44, 45]
  interaction-mode: yolo
  
Workflow:
1. Process PRs in parallel using parallel-execution
2. Each PR follows full process-pr workflow
3. Report summary of all PRs
适用于处理大量PR:
markdown
Parameters:
  pr-number: [42, 43, 44, 45]
  interaction-mode: yolo
  
Workflow:
1. Process PRs in parallel using parallel-execution
2. Each PR follows full process-pr workflow
3. Report summary of all PRs

Best Practices

最佳实践

  1. Use appropriate mode: YOLO for routine, collaborative for critical
  2. Run local checks: Catch issues before CI
  3. Address comments promptly: Don't skip feedback
  4. Verify before merge: Never rush the final checks
  5. Clean up branches: Delete after merge
  6. Monitor CI: Ensure checks complete before merge
  7. Document decisions: Log choices made during process
  8. Consistent method: Use same merge method across repo
  1. 选择合适模式:常规PR用YOLO模式,关键PR用协作模式
  2. 运行本地检查:在CI之前发现问题
  3. 及时处理评论:不要跳过反馈
  4. 合并前验证:不要仓促完成最终检查
  5. 清理分支:合并后删除分支
  6. 监控CI:确保检查完成后再合并
  7. 记录决策:记录过程中做出的选择
  8. 保持一致:仓库内使用统一的合并方式

Safety Guardrails

安全防护

Always enforce:
  • ✅ Required approvals received
  • ✅ All required checks pass
  • ✅ No merge conflicts
  • ✅ PR is actually open
  • ✅ Targeting correct base branch
Never:
  • ❌ Merge with failing tests
  • ❌ Skip required approvals
  • ❌ Override branch protection
  • ❌ Ignore unresolved blockers
  • ❌ Merge conflicted PRs
始终强制执行:
  • ✅ 已获取所需的审核通过
  • ✅ 所有必填检查通过
  • ✅ 无合并冲突
  • ✅ PR处于打开状态
  • ✅ 目标基准分支正确
绝对禁止:
  • ❌ 合并测试失败的PR
  • ❌ 跳过必填的审核通过
  • ❌ 绕过分支保护规则
  • ❌ 忽略未解决的阻塞项
  • ❌ 合并存在冲突的PR

Output Format

输出格式

YOLO Mode Output

YOLO模式输出

markdown
TASK: Process PR #42
STATUS: Complete

STAGES COMPLETED:
✅ Stage 1: Initial Assessment (3 checks)
✅ Stage 2: Local Verification (tests, lint, build)
✅ Stage 3: Address Feedback (3 comments resolved)
✅ Stage 4: Final Verification (all pass)
✅ Stage 5: Merge (squash method)

SUMMARY:
- PR #42: "Add authentication middleware"
- Comments addressed: 3
- Files changed: 4
- Tests: All passing
- Approvals: 2 (alice, bob)
- Merge method: Squash
- Branch: feature-auth (deleted)

RESULT: Successfully merged to main
TIME: 8 minutes (5min CI wait)
markdown
TASK: Process PR #42
STATUS: Complete

STAGES COMPLETED:
✅ Stage 1: Initial Assessment (3 checks)
✅ Stage 2: Local Verification (tests, lint, build)
✅ Stage 3: Address Feedback (3 comments resolved)
✅ Stage 4: Final Verification (all pass)
✅ Stage 5: Merge (squash method)

SUMMARY:
- PR #42: "Add authentication middleware"
- Comments addressed: 3
- Files changed: 4
- Tests: All passing
- Approvals: 2 (alice, bob)
- Merge method: Squash
- Branch: feature-auth (deleted)

RESULT: Successfully merged to main
TIME: 8 minutes (5min CI wait)

Collaborative Mode Output

协作模式输出

markdown
PR Processing: #42

Current Stage: 3/5 - Addressing Feedback
Progress: [████████░░] 80%

✅ Stage 1: Initial Assessment
✅ Stage 2: Local Verification
⏳ Stage 3: Addressing Feedback (2/3 comments)
⬜ Stage 4: Final Verification
⬜ Stage 5: Merge

Current Action: Resolving review thread on auth.ts:42
Waiting for: User confirmation to proceed

Next: 1 more comment, then final checks
markdown
PR Processing: #42

Current Stage: 3/5 - Addressing Feedback
Progress: [████████░░] 80%

✅ Stage 1: Initial Assessment
✅ Stage 2: Local Verification
⏳ Stage 3: Addressing Feedback (2/3 comments)
⬜ Stage 4: Final Verification
⬜ Stage 5: Merge

Current Action: Resolving review thread on auth.ts:42
Waiting for: User confirmation to proceed

Next: 1 more comment, then final checks

Integration Examples

集成示例

Example 1: Single PR Full Process

示例1:单个PR完整处理

markdown
User: "Process PR #42 end-to-end"

Execution:
- Uses: process-pr (this workflow)
- Mode: collaborative (default)
- Stages: All 5 stages
- Output: Interactive progress updates
markdown
User: "Process PR #42 end-to-end"

Execution:
- Uses: process-pr (this workflow)
- Mode: collaborative (default)
- Stages: All 5 stages
- Output: Interactive progress updates

Example 2: Batch PR Processing

示例2:批量PR处理

markdown
User: "Process all approved PRs"

Execution:
1. List open PRs
2. Filter for approved PRs
3. Use parallel-execution to spawn:
   - process-pr for PR #42
   - process-pr for PR #43
   - process-pr for PR #44
4. Each uses yolo mode
5. Report summary of all
markdown
User: "Process all approved PRs"

Execution:
1. List open PRs
2. Filter for approved PRs
3. Use parallel-execution to spawn:
   - process-pr for PR #42
   - process-pr for PR #43
   - process-pr for PR #44
4. Each uses yolo mode
5. Report summary of all

Example 3: PR Pipeline

示例3:PR自动化流水线

markdown
User: "Set up automated PR pipeline"

Execution:
1. Monitor for new reviews/approvals
2. When PR approved:
   - Trigger process-pr in yolo mode
   - Auto-merge if all checks pass
3. Notify on completion
markdown
User: "Set up automated PR pipeline"

Execution:
1. Monitor for new reviews/approvals
2. When PR approved:
   - Trigger process-pr in yolo mode
   - Auto-merge if all checks pass
3. Notify on completion

Quick Reference

快速参考

markdown
PURPOSE:
  End-to-end PR processing from review to merge

COMPOSITION:
  parallel-execution + sequential-execution + pull-request-tool +
  resolve-pr-comments + merge-pr + (yolo OR collaborative)

MODES:
  YOLO:          Fully autonomous end-to-end
  Collaborative: Interactive with checkpoints

STAGES:
  1. Initial Assessment (parallel)
  2. Local Verification (sequential)
  3. Address Feedback (sequential)
  4. Final Verification (parallel)
  5. Merge (sequential)

PARAMETERS:
  pr-number:        Required (single or array)
  repository:       Required (owner/repo)
  interaction-mode: yolo or collaborative
  merge-method:     merge/squash/rebase
  delete-branch:    true (default)
  run-local-checks: true (default)
  resolve-comments: true (default)

OPTIMIZATION:
  - Parallel where possible (assessment, verification)
  - Sequential where needed (comments, merge)
  - Mixed for optimal speed

SAFETY:
  Always verify:
  - Required approvals
  - All checks pass
  - No conflicts
  - Correct base branch
  
  Never:
  - Merge with failing tests
  - Skip approvals
  - Override protection
markdown
PURPOSE:
  End-to-end PR processing from review to merge

COMPOSITION:
  parallel-execution + sequential-execution + pull-request-tool +
  resolve-pr-comments + merge-pr + (yolo OR collaborative)

MODES:
  YOLO:          Fully autonomous end-to-end
  Collaborative: Interactive with checkpoints

STAGES:
  1. Initial Assessment (parallel)
  2. Local Verification (sequential)
  3. Address Feedback (sequential)
  4. Final Verification (parallel)
  5. Merge (sequential)

PARAMETERS:
  pr-number:        Required (single or array)
  repository:       Required (owner/repo)
  interaction-mode: yolo or collaborative
  merge-method:     merge/squash/rebase
  delete-branch:    true (default)
  run-local-checks: true (default)
  resolve-comments: true (default)

OPTIMIZATION:
  - Parallel where possible (assessment, verification)
  - Sequential where needed (comments, merge)
  - Mixed for optimal speed

SAFETY:
  Always verify:
  - Required approvals
  - All checks pass
  - No conflicts
  - Correct base branch
  
  Never:
  - Merge with failing tests
  - Skip approvals
  - Override protection

Related Skills

相关技能

  • pull-request-tool: For PR interaction, checks, and merge operations
  • resolve-pr-comments: For handling review feedback during PR processing
  • merge-pr: For executing merge with proper verification and cleanup
  • handle-pr-feedback: For triaging feedback severity and routing decisions
  • update-work-item: For updating work item status when PR is merged
  • parallel-execution: For concurrent assessment of PR readiness
  • sequential-execution: For ordered workflow phases (assess → resolve → merge)
  • pull-request-tool: 用于PR交互、检查和合并操作
  • resolve-pr-comments: 用于PR处理期间的审核反馈处理
  • merge-pr: 用于执行带验证和清理的合并操作
  • handle-pr-feedback: 用于对反馈进行优先级划分和决策路由
  • update-work-item: 用于PR合并时更新工作项状态
  • parallel-execution: 用于并发评估PR就绪状态
  • sequential-execution: 用于有序的工作流阶段(评估→处理→合并)