Skip to content

feat: improve release workflow with test gate, changelog script and smart summary#55

Merged
ShellMonster merged 2 commits into
mainfrom
improve/release-workflow
Apr 22, 2026
Merged

feat: improve release workflow with test gate, changelog script and smart summary#55
ShellMonster merged 2 commits into
mainfrom
improve/release-workflow

Conversation

@ShellMonster
Copy link
Copy Markdown
Owner

@ShellMonster ShellMonster commented Apr 22, 2026

User description

Summary

  • 新增发布前检查 job:构建前运行 go vetgo buildnpm cinpm run build,防止发布坏包
  • 抽取 changelog 生成脚本:从 release.yml 内联 shell(56行)抽取为 scripts/generate-changelog.sh,逻辑更清晰可维护
  • 过滤噪音 commitchore:, ci:, release:, bump:, test:, ignore: 前缀不再出现在 release notes
  • Full Changelog 链接:release notes 底部自动生成版本对比链接
  • 智能更新概要:基于变更文件路径自动生成模块级摘要(如"AI 提供商接口适配与模型支持更新"),覆盖 12 个模块

Test plan

  • bash -n scripts/generate-changelog.sh 语法检查通过
  • YAML 语法检查通过
  • 用 v2.8.1 tag 本地测试脚本输出正确
  • 合并后下一个 tag push 触发完整流水线验证

CodeAnt-AI Description

Add a release workflow check and cleaner release notes

What Changed

  • Release runs a pre-publish check that verifies backend code, backend build, frontend install, and frontend build before any package is published
  • Release notes now come from a shared script, which keeps the output consistent and adds a Full Changelog link for each version
  • Noise commits such as chore, ci, release, bump, test, and ignore no longer appear in release notes
  • Release notes now include a short module summary based on the files changed, plus grouped sections for features, fixes, docs, and other changes

Impact

✅ Fewer broken releases
✅ Cleaner release notes
✅ Easier upgrade review

🔄 Retrigger CodeAnt AI Review

Details

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

…mart summary

- Extract inline changelog shell into scripts/generate-changelog.sh
- Add test job (go vet, go build, npm ci, npm run build) before release
- Filter noise commits (chore/ci/release/bump/test/ignore) from notes
- Add Full Changelog diff link at release notes bottom
- Add path-based smart summary (detects changed modules automatically)
@codeant-ai
Copy link
Copy Markdown

codeant-ai Bot commented Apr 22, 2026

CodeAnt AI is reviewing your PR.


Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

本次 PR 旨在优化项目的发布工作流,通过引入严格的构建前检查和自动化的 changelog 生成机制,提升发布过程的稳定性和文档质量。通过智能分析变更路径,系统能够自动归纳模块更新,减少人工编写 release notes 的负担。

Highlights

  • 发布前质量门禁: 新增发布前检查 job,通过运行 go vet、go build 及 npm 构建流程,有效防止发布坏包。
  • Changelog 自动化优化: 将 changelog 生成逻辑从 YAML 抽取至独立脚本,支持过滤噪音 commit 并自动生成模块级更新概要。
  • 发布体验提升: 自动生成版本对比链接,并根据变更文件路径智能生成模块级摘要,提升 release notes 的可读性。
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/release.yml
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@codeant-ai codeant-ai Bot added the size:L This PR changes 100-499 lines, ignoring generated files label Apr 22, 2026
@codacy-production
Copy link
Copy Markdown

codacy-production Bot commented Apr 22, 2026

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes. Give us feedback

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new shell script, generate-changelog.sh, which automates the generation of changelogs by categorizing git commits and identifying modified project modules. Feedback focused on adhering to the project's style guide regarding Chinese documentation for complex logic and improving the script's robustness by replacing echo with printf to safely handle special characters in commit messages and output.

Comment on lines +1 to +4
#!/usr/bin/env bash
# 用法: ./scripts/generate-changelog.sh <current_tag> [repo_url]
# 输出 GITHUB_OUTPUT 多行格式: body<<EOF ... EOF
set -euo pipefail
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

根据项目代码审查规范第 89 条和第 90 条,复杂逻辑应有中文注释,且函数应有文档注释。虽然脚本整体逻辑清晰,但建议在脚本开头添加功能描述,并为 touches 函数及后续的 Commit 分类循环、GitHub Output 格式输出等关键逻辑块添加简要的中文说明,以提高代码的可维护性。

References
  1. 复杂逻辑必须有中文注释说明;公共函数必须有文档注释 (link)

Comment on lines +15 to +17
touches() {
echo "$CHANGED_FILES" | grep -qE "$1" 2>/dev/null
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

在处理可能包含特殊字符(如以 - 开头)的变量时,使用 printfecho 更健壮。此外,grep -q 已经静默输出,通常不需要重定向 2>/dev/null

Suggested change
touches() {
echo "$CHANGED_FILES" | grep -qE "$1" 2>/dev/null
}
touches() {
printf "%s\n" "$CHANGED_FILES" | grep -qE "$1"
}

Comment thread scripts/generate-changelog.sh Outdated
[ -z "$line" ] && continue
[[ $line =~ $NOISE_REGEX ]] && continue

clean_line=$(echo "$line" | sed 's/\\/\\\\/g; s/`/\\`/g')
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

建议使用 printf 代替 echo 以避免 commit message 内容被误认为 echo 选项。另外,如果后续输出不再使用 echo -e,则无需在此处对反斜杠进行双重转义,仅保留对 Markdown 特殊字符(如反引号)的处理即可。

Suggested change
clean_line=$(echo "$line" | sed 's/\\/\\\\/g; s/`/\\`/g')
clean_line=$(printf "%s" "$line" | sed 's/`/\\`/g')

Comment thread scripts/generate-changelog.sh Outdated

{
echo "body<<EOF"
echo -e "$BODY"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

建议使用 printf "%s\n" 代替 echo -eecho -e 会解析变量中的转义序列(如 \n, \t),可能导致 commit message 中的原始字符被意外转换。由于 $BODY 变量已包含所需的换行符,直接输出即可保证内容的原始性。

Suggested change
echo -e "$BODY"
printf "%s\n" "$BODY"

Comment thread scripts/generate-changelog.sh Outdated
Comment on lines +86 to +88
if [[ $line =~ ^feat ]]; then
FEATS="$FEATS
- ${clean_line#feat: }"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: The matcher classifies any subject starting with feat (including feat(scope): ...) but the string trim only removes the exact feat: prefix, so scoped conventional commits are rendered with their raw prefix instead of clean titles. This produces malformed/unclean release notes. Strip commit type using a pattern that handles scoped and bang variants consistently (e.g., feat(scope)!:). [logic error]

Severity Level: Major ⚠️
- ⚠️ Features section shows noisy feat(scope): prefixes.
- ⚠️ Generated release notes look inconsistent across commit styles.
Steps of Reproduction ✅
1. A tag push triggers the release workflow `.github/workflows/release.yml`, which runs
the changelog script in the "生成 Release Notes" step at lines 16–19 with `CURRENT_TAG` set
to the tag name and a repository URL.

2. Between `PREV_TAG` and `CURRENT_TAG`, assume there is at least one commit following the
Conventional Commits style with a scope, for example `feat(desktop): Improve navbar`,
which is realistic given the script's use of type prefixes (`feat`, `fix`, `docs`, etc.)
and scoped paths (desktop/backend) in `scripts/generate-changelog.sh`.

3. At `scripts/generate-changelog.sh:73`, `LOGS` is populated by `git log
"$PREV_TAG".."$CURRENT_TAG" --pretty=format:"%s" --no-merges`, so the literal subject
`feat(desktop): Improve navbar` is included. The processing loop at lines 80–102 reads
each line into `line`, skips noise via `NOISE_REGEX` at line 72 (which does not filter
`feat(...)`), and builds `clean_line` at line 84.

4. For this feature commit, the condition `if [[ $line =~ ^feat ]]; then` at line 86
evaluates true (it matches `feat(desktop):`), but the string trimming `${clean_line#feat:
}` at line 88 only removes the literal `feat: ` prefix, not `feat(scope): `. As a result,
the generated Features section at lines 113–116 contains an entry like `- feat(desktop):
Improve navbar` instead of a normalized `- Improve navbar`, while unscoped `feat: Add X`
entries are rendered cleanly. This creates inconsistent and noisy feature titles whenever
scoped `feat(scope):` commits are present in the release range.

Fix in Cursor | Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** scripts/generate-changelog.sh
**Line:** 86:88
**Comment:**
	*Logic Error: The matcher classifies any subject starting with `feat` (including `feat(scope): ...`) but the string trim only removes the exact `feat: ` prefix, so scoped conventional commits are rendered with their raw prefix instead of clean titles. This produces malformed/unclean release notes. Strip commit type using a pattern that handles scoped and bang variants consistently (e.g., `feat(scope)!:`).

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

@codeant-ai
Copy link
Copy Markdown

codeant-ai Bot commented Apr 22, 2026

CodeAnt AI finished reviewing your PR.

- Replace echo with printf for robustness with special characters
- Fix scoped conventional commit prefix stripping (feat(scope):)
- Use POSIX [[:space:]] instead of \s for BSD sed compatibility
- Replace echo -e with printf for safe output
@ShellMonster ShellMonster merged commit 7082f55 into main Apr 22, 2026
5 checks passed
@ShellMonster ShellMonster deleted the improve/release-workflow branch April 22, 2026 05:52
ShellMonster added a commit that referenced this pull request Apr 27, 2026
…mart summary (#55)

* feat: improve release workflow with test gate, changelog script and smart summary

- Extract inline changelog shell into scripts/generate-changelog.sh
- Add test job (go vet, go build, npm ci, npm run build) before release
- Filter noise commits (chore/ci/release/bump/test/ignore) from notes
- Add Full Changelog diff link at release notes bottom
- Add path-based smart summary (detects changed modules automatically)

* fix: address code review feedback on changelog script

- Replace echo with printf for robustness with special characters
- Fix scoped conventional commit prefix stripping (feat(scope):)
- Use POSIX [[:space:]] instead of \s for BSD sed compatibility
- Replace echo -e with printf for safe output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant