-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ci: support generate release pr via release-please workflow #535
Conversation
变更概述演练这个拉取请求引入了一个新的 GitHub Actions 工作流程 变更
诗歌
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (2)
.github/workflows/prepare-release.yml (2)
3-11
: 建议增加主分支保护工作流程在推送到 master 分支时触发。建议:
- 启用分支保护规则,禁止直接推送到 master
- 改用
pull_request
触发器,确保所有更改都经过审查权限配置已正确设置,符合最小权限原则。
13-17
: 优化作业配置以提高可重用性和效率当前配置存在以下可优化点:
- 硬编码的仓库名称
skyclouds2001/template-sky
限制了工作流程的可重用性- 60分钟的超时时间对于发布准备任务来说可能过长
建议应用以下改进:
prepare-release: name: Prepare release - if: github.repository == 'skyclouds2001/template-sky' + if: ${{ github.repository == vars.ALLOWED_REPOSITORY }} - timeout-minutes: 60 + timeout-minutes: 15 runs-on: ubuntu-latest
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
.github/workflows/prepare-release.yml
(1 hunks).release-please-manifest.json
(1 hunks)release-please-config.json
(1 hunks)
✅ Files skipped from review due to trivial changes (2)
- .release-please-manifest.json
- release-please-config.json
🔇 Additional comments (1)
.github/workflows/prepare-release.yml (1)
1-21
: 验证发布工作流集成
在合并之前,请验证:
- 与现有的 CI/CD 流程的兼容性
- 是否存在重复的发布自动化工具
- 版本号管理策略是否符合项目要求
✅ Verification successful
Let me check the content of the release.yml workflow to understand if there are any conflicts.
Let me fix the file search command to properly check other configuration files.
发布工作流配置验证完成
基于验证结果,当前的发布工作流配置是合理的:
-
工作流职责划分清晰:
prepare-release.yml
负责版本更新和创建发布PRrelease.yml
负责在标签推送后执行 GitHub 发布和 npm 包发布
-
版本管理配置完整:
- 使用 release-please 进行版本管理
- package.json 中已配置版本信息
- CHANGELOG.md 文件存在用于记录变更
-
自动化流程完整:
- 支持 GitHub Release 发布
- 支持 npm 包发布
- 包含适当的权限控制
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# 检查是否存在其他发布相关的工作流程
echo "检查其他发布工作流..."
fd -e yml -e yaml . .github/workflows -x grep -l "release" {}
# 检查包版本管理配置
echo "检查版本管理配置..."
fd -g "package.json" -x jq -r '.version'
fd -g "release-please-config.json" -x cat {}
Length of output: 746
Script:
#!/bin/bash
# 检查 release.yml 的内容
echo "检查 release.yml 的内容..."
cat .github/workflows/release.yml
# 检查是否有其他与版本或发布相关的配置
echo "检查其他配置文件..."
fd -g ".*rc" -g ".*json" -x grep -l "version\|release" {}
Length of output: 1632
Script:
#!/bin/bash
# 检查其他配置文件
echo "检查配置文件..."
fd -e json -e rc . -x grep -l "version\|release" {}
# 检查 CHANGELOG.md 是否存在及其内容
echo "检查 CHANGELOG.md..."
test -f CHANGELOG.md && echo "CHANGELOG.md 存在" || echo "CHANGELOG.md 不存在"
Length of output: 306
- uses: googleapis/[email protected] | ||
with: | ||
release-type: node |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
完善 release-please-action 配置
当前配置过于简单,建议添加以下重要配置项以增强发布管理:
- uses: googleapis/[email protected]
with:
release-type: node
+ package-name: ${{ vars.PACKAGE_NAME }}
+ changelog-types: |
+ [
+ {"type":"feat","section":"✨ 新功能","hidden":false},
+ {"type":"fix","section":"🐛 问题修复","hidden":false},
+ {"type":"docs","section":"📝 文档","hidden":false},
+ {"type":"chore","section":"📦 杂项","hidden":true}
+ ]
+ bootstrap-sha: ${{ vars.INITIAL_VERSION_SHA }}
+ token: ${{ secrets.GITHUB_TOKEN }}
这些配置将帮助:
- 正确设置包名称
- 自定义更新日志格式
- 设置版本历史起点
- 明确指定令牌来源
Committable suggestion skipped: line range outside the PR's diff.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
release-please-config.json (2)
5-10
: 建议优化 changelog 分类当前的变更日志分类已经涵盖了主要类型,但建议考虑添加以下常见类型:
perf
: 性能优化test
: 测试相关ci
: CI/CD 变更"changelog-sections": [ { "type": "feat", "section": "Features", "hidden": false }, { "type": "fix", "section": "Bug Fixes", "hidden": false }, { "type": "docs", "section": "Documentations", "hidden": false }, + { "type": "perf", "section": "Performance", "hidden": false }, + { "type": "test", "section": "Tests", "hidden": false }, + { "type": "ci", "section": "CI/CD", "hidden": false }, { "type": "chore", "section": "Miscellaneous", "hidden": false } ],
11-14
: 包配置结构合理当前的包配置适用于单包项目,设置正确。如果未来需要支持 monorepo,可以在此处添加其他包的配置。
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
release-please-config.json
(1 hunks)
🔇 Additional comments (3)
release-please-config.json (3)
2-2
: 配置文件架构验证设置正确!
使用 schema URL 可以确保配置文件格式的正确性,这是一个很好的实践。
4-4
: 确认 node release-type 的适用性
配置使用了 "node" 作为发布类型,这与项目的 package.json 相匹配。
3-3
: 验证 last-release-sha 的有效性
需要确保这个 SHA 值确实对应于最后一次发布的提交。
Summary
How did you test this change?
Summary by CodeRabbit
新功能
配置更新