review-pr

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Review PR

审查PR

Review a GitHub pull request, verify CI status, and merge + tag a release if appropriate.
审查GitHub拉取请求,验证CI状态,合适的情况下合并并打上版本标签发布。

Workflow

工作流程

1. Fetch PR details

1. 获取PR详情

Use
gh
CLI to get the PR diff, description, and CI status:
bash
gh pr view <number> --json title,body,additions,deletions,files,reviews,statusCheckRollup,headRefName,baseRefName
gh pr diff <number>
使用
gh
CLI获取PR的差异、描述和CI状态:
bash
gh pr view <number> --json title,body,additions,deletions,files,reviews,statusCheckRollup,headRefName,baseRefName
gh pr diff <number>

2. Review the changes

2. 审查变更

Carefully review the diff. Pay attention to:
  • Code quality and correctness
  • Potential bugs or edge cases
  • Whether the change matches the PR description
  • Test coverage for new functionality
  • Adherence to existing code style and patterns in the package
If there are issues, post a review comment via
gh pr review <number> --request-changes --body "..."
and stop.
仔细审查diff,注意以下要点:
  • 代码质量与正确性
  • 潜在的Bug或边缘场景
  • 变更内容是否与PR描述匹配
  • 新功能的测试覆盖率
  • 是否符合包的现有代码风格与模式
如果存在问题,通过
gh pr review <number> --request-changes --body "..."
提交审查评论并终止流程。

3. Check CI status

3. 检查CI状态

All CI checks must be green before merging. Verify via the
statusCheckRollup
field from step 1. If CI is failing or pending, inform the user and stop.
合并前所有CI检查必须全部通过。通过步骤1返回的
statusCheckRollup
字段进行验证。如果CI运行失败或处于待执行状态,告知用户并终止流程。

4. Merge and release

4. 合并与发布

If the review looks good and CI is green:
  1. Merge the PR:
    gh pr merge <number> --squash --delete-branch
  2. Determine the appropriate version bump by checking the latest tag:
    gh release list --limit 1
  3. Tag a new release with the next appropriate version number
如果审查通过且CI状态正常:
  1. 合并PR:
    gh pr merge <number> --squash --delete-branch
  2. 检查最新发布标签,确定合适的版本号升级幅度:
    gh release list --limit 1
  3. 使用合适的下一版本号打标签,发布新版本

Versioning rules

版本号规则

  • NEVER tag a major version bump without explicit user approval. Always ask first.
  • Dropping support for a PHP or Laravel version is NOT a breaking change — use a minor or patch bump.
  • New features: minor version bump (e.g. 1.2.0 → 1.3.0)
  • Bug fixes, typos, dependency updates: patch version bump (e.g. 1.2.0 → 1.2.1)
  • When in doubt about the version bump level, ask the user.
  • 未经用户明确批准,绝对不要升级主版本号,务必先询问用户。
  • 停止支持某个PHP或Laravel版本不属于破坏性变更——使用次版本号或修订版本号升级即可。
  • 新功能:次版本号升级(例如 1.2.0 → 1.3.0)
  • Bug修复、拼写错误修正、依赖更新:修订版本号升级(例如 1.2.0 → 1.2.1)
  • 如果不确定版本号升级幅度,询问用户。

Creating the release

创建发布

bash
gh release create <tag> --title "<tag>" --generate-notes
Use
--generate-notes
to auto-generate release notes from the merged PR.
bash
gh release create <tag> --title "<tag>" --generate-notes
使用
--generate-notes
参数从已合并的PR自动生成发布说明。