Skip to content

Conversation

@Cloxl
Copy link
Owner

@Cloxl Cloxl commented Jan 15, 2026

由 Sourcery 提供的总结

改进 GitHub 发布流程,以生成更丰富的发布说明,并修正已发布版本的版本号格式。

CI:

  • 扩展发布工作流,以拉取完整的 git 历史,并计算 GitHub Releases 中各标签之间的变更日志内容。
  • 更新发布正文模板,以包含生成的变更日志、安装说明、快速上手使用示例以及项目资源链接。
Original summary in English

Summary by Sourcery

Improve the GitHub release workflow to generate richer release notes and correct version formatting for published releases.

CI:

  • Extend the release workflow to fetch full git history and compute changelog content between tags for GitHub Releases.
  • Update the release body template to include generated changelog, installation instructions, quick-start usage examples, and links to project resources.

@sourcery-ai
Copy link

sourcery-ai bot commented Jan 15, 2026

Reviewer's Guide

更新发布 GitHub Actions 工作流,以从 git 历史生成自定义发布说明,导出规范化版本字符串供安装命令/文档链接使用,并使用英文示例和元数据对发布内容进行现代化改造。

更新后的 GitHub Actions 发布说明生成时序图

sequenceDiagram
    actor Maintainer
    participant GitHubRepo
    participant GitHubActions
    participant actions_checkout_v4
    participant release_notes_step
    participant git_cli
    participant action_gh_release_v2

    Maintainer->>GitHubRepo: Push tag vX.Y.Z
    GitHubRepo-->>GitHubActions: Trigger release workflow

    GitHubActions->>actions_checkout_v4: Checkout repository (fetch-depth 0)
    actions_checkout_v4-->>GitHubActions: Repository with full tag history

    GitHubActions->>release_notes_step: Run Generate release notes step
    release_notes_step->>release_notes_step: Read github.ref_name as VERSION
    release_notes_step->>release_notes_step: Strip leading v to create VERSION_NO_V
    release_notes_step->>git_cli: git describe --tags --abbrev=0 HEAD^
    git_cli-->>release_notes_step: PREV_TAG or empty

    alt Previous tag exists
        release_notes_step->>git_cli: git log PREV_TAG..HEAD --no-merges
        git_cli-->>release_notes_step: Commit list
        release_notes_step->>GitHubActions: Set outputs CHANGELOG and VERSION_NO_V
    else No previous tag
        release_notes_step->>GitHubActions: Set outputs CHANGELOG="Initial release" and VERSION_NO_V
    end

    GitHubActions->>action_gh_release_v2: Create GitHub Release
    action_gh_release_v2->>action_gh_release_v2: generate_release_notes true
    action_gh_release_v2->>action_gh_release_v2: Use CHANGELOG as body prefix
    action_gh_release_v2->>GitHubRepo: Publish Release with install commands using VERSION_NO_V
Loading

File-Level Changes

Change Details Files
Generate release notes dynamically from git history and expose outputs for later workflow steps.
  • 通过设置 fetch-depth: 0 配置 checkout 拉取完整 git 历史。
  • 新增一个 shell 步骤,从 github.ref_name 计算 VERSION 和 VERSION_NO_V。
  • 通过 git describe 确定上一个 tag,以定义 changelog 范围。
  • 构建一个包含提交摘要和完整变更对比 URL 的 markdown 变更日志(CHANGELOG)。
  • 将 VERSION_NO_V 和 CHANGELOG 写入 GITHUB_OUTPUT 供后续步骤使用,并为初始发布提供回退消息。
.github/workflows/release.yml
Adjust GitHub Release creation to use generated notes and normalized version in the release body.
  • 在 softprops/action-gh-release 上启用 generate_release_notes: true,以在自定义 body 之外使用 GitHub 的自动发布说明。
  • 用一个模板化的 markdown body 替换之前的中文静态 body,将生成的 CHANGELOG 和 VERSION_NO_V 输出注入其中。
  • 更新安装说明,将依赖固定到派生的版本号而不是原始 tag 名。
  • 添加使用 pip install --upgrade xhshow 的显式升级命令。
  • 刷新快速开始示例,以展示当前的 API 使用模式和端点,包括 SessionManager 和请求头签名。
  • 添加指向 GitHub 和 PyPI 的链接,使用仓库名和 VERSION_NO_V 指向精确的发布版本。
  • 文档中注明支持的 Python 版本(3.10–3.12)。
.github/workflows/release.yml

Tips and commands

Interacting with Sourcery

  • 触发新评审: 在 pull request 中评论 @sourcery-ai review
  • 继续讨论: 直接回复 Sourcery 的评审评论。
  • 从评审评论生成 GitHub Issue: 在某条评审评论下回复,要求 Sourcery 基于该评论创建 issue。你也可以直接回复 @sourcery-ai issue 来从该评论创建 issue。
  • 生成 pull request 标题: 在 pull request 标题中任意位置写上 @sourcery-ai 即可随时生成标题。你也可以在 pull request 中评论 @sourcery-ai title 来(重新)生成标题。
  • 生成 pull request 摘要: 在 pull request 描述中任意位置写上 @sourcery-ai summary,即可在该位置生成 PR 摘要。你也可以在 pull request 中评论 @sourcery-ai summary 来(重新)生成摘要。
  • 生成评审者指南: 在 pull request 中评论 @sourcery-ai guide,即可随时(重新)生成评审者指南。
  • 一次性解决所有 Sourcery 评论: 在 pull request 中评论 @sourcery-ai resolve,即可解决所有 Sourcery 评论。适用于你已经处理完所有评论且不想再看到它们的情况。
  • 关闭所有 Sourcery 评审: 在 pull request 中评论 @sourcery-ai dismiss,即可关闭所有现有的 Sourcery 评审。特别适合你想从头开始一次新评审的场景——别忘了评论 @sourcery-ai review 来触发新的评审!

Customizing Your Experience

访问你的 dashboard 以:

  • 启用或禁用评审功能,例如 Sourcery 自动生成的 pull request 摘要、评审者指南等。
  • 更改评审语言。
  • 添加、删除或编辑自定义评审说明。
  • 调整其他评审设置。

Getting Help

Original review guide in English

Reviewer's Guide

Updates the release GitHub Actions workflow to generate custom release notes from git history, expose a normalized version string for use in installation/docs links, and modernizes the release body content with English-language usage examples and metadata.

Sequence diagram for updated GitHub Actions release notes generation

sequenceDiagram
    actor Maintainer
    participant GitHubRepo
    participant GitHubActions
    participant actions_checkout_v4
    participant release_notes_step
    participant git_cli
    participant action_gh_release_v2

    Maintainer->>GitHubRepo: Push tag vX.Y.Z
    GitHubRepo-->>GitHubActions: Trigger release workflow

    GitHubActions->>actions_checkout_v4: Checkout repository (fetch-depth 0)
    actions_checkout_v4-->>GitHubActions: Repository with full tag history

    GitHubActions->>release_notes_step: Run Generate release notes step
    release_notes_step->>release_notes_step: Read github.ref_name as VERSION
    release_notes_step->>release_notes_step: Strip leading v to create VERSION_NO_V
    release_notes_step->>git_cli: git describe --tags --abbrev=0 HEAD^
    git_cli-->>release_notes_step: PREV_TAG or empty

    alt Previous tag exists
        release_notes_step->>git_cli: git log PREV_TAG..HEAD --no-merges
        git_cli-->>release_notes_step: Commit list
        release_notes_step->>GitHubActions: Set outputs CHANGELOG and VERSION_NO_V
    else No previous tag
        release_notes_step->>GitHubActions: Set outputs CHANGELOG="Initial release" and VERSION_NO_V
    end

    GitHubActions->>action_gh_release_v2: Create GitHub Release
    action_gh_release_v2->>action_gh_release_v2: generate_release_notes true
    action_gh_release_v2->>action_gh_release_v2: Use CHANGELOG as body prefix
    action_gh_release_v2->>GitHubRepo: Publish Release with install commands using VERSION_NO_V
Loading

File-Level Changes

Change Details Files
Generate release notes dynamically from git history and expose outputs for later workflow steps.
  • Configures checkout to fetch full git history by setting fetch-depth: 0.
  • Adds a shell step that computes VERSION and VERSION_NO_V from github.ref_name.
  • Determines the previous tag via git describe to define the changelog range.
  • Builds a markdown changelog (CHANGELOG) with commit summaries and a full changelog comparison URL.
  • Writes VERSION_NO_V and CHANGELOG to GITHUB_OUTPUT for use by later steps, with a fallback message for initial releases.
.github/workflows/release.yml
Adjust GitHub Release creation to use generated notes and normalized version in the release body.
  • Enables generate_release_notes: true on softprops/action-gh-release to use GitHub’s automatic notes in addition to the custom body.
  • Replaces the previous Chinese-language static body with a templated markdown body that injects the generated CHANGELOG and VERSION_NO_V outputs.
  • Updates installation instructions to pin to the derived version number instead of the raw tag name.
  • Adds an explicit upgrade command using pip install --upgrade xhshow.
  • Refreshes the Quick Start example to showcase current API usage patterns and endpoints, including SessionManager and header signing.
  • Adds links to GitHub and PyPI using the repository name and VERSION_NO_V for the exact release.
  • Documents supported Python versions (3.10–3.12).
.github/workflows/release.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - 我提供了一些高层面的反馈:

  • 在同时使用 generate_release_notes: true 并提供自定义 body 的情况下会显得多余且可能令人困惑;如果你打算完全依赖手动生成的 CHANGELOG 输出,建议移除 generate_release_notes
  • 对于 git log ${PREV_TAG}..HEAD 的调用,建议给范围加上引号(git log "${PREV_TAG}..HEAD"),并在使用标签变量时也加上引号,以防标签名包含意料之外的字符,这会让脚本更加健壮。
给 AI 智能体的提示
Please address the comments from this code review:

## Overall Comments
- Using `generate_release_notes: true` while also supplying a custom `body` is redundant and can be confusing; consider removing `generate_release_notes` if you intend to rely solely on the manually generated `CHANGELOG` output.
- For the `git log ${PREV_TAG}..HEAD` call, consider quoting the range (`git log "${PREV_TAG}..HEAD"`) and the tag variable usages in case tag names ever contain unexpected characters, which will make the script more robust.

Sourcery 对开源项目是免费的——如果你觉得我们的评审有帮助,欢迎分享 ✨
帮我变得更有用!请在每条评论上点击 👍 或 👎,我会根据你的反馈改进后续的评审。
Original comment in English

Hey - I've left some high level feedback:

  • Using generate_release_notes: true while also supplying a custom body is redundant and can be confusing; consider removing generate_release_notes if you intend to rely solely on the manually generated CHANGELOG output.
  • For the git log ${PREV_TAG}..HEAD call, consider quoting the range (git log "${PREV_TAG}..HEAD") and the tag variable usages in case tag names ever contain unexpected characters, which will make the script more robust.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Using `generate_release_notes: true` while also supplying a custom `body` is redundant and can be confusing; consider removing `generate_release_notes` if you intend to rely solely on the manually generated `CHANGELOG` output.
- For the `git log ${PREV_TAG}..HEAD` call, consider quoting the range (`git log "${PREV_TAG}..HEAD"`) and the tag variable usages in case tag names ever contain unexpected characters, which will make the script more robust.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@Cloxl Cloxl merged commit b98168c into master Jan 15, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants