Skip to content

Conversation

@YDX-2147483647
Copy link
Member

之前没设置好git-cliff(也可能是git-cliff有缺陷),预发布版的发行说明没有东西,例如 https://github.com/BITNP/BIThesis/releases/tag/v3.8.8-alpha.2

原因分析

(非常混乱,但 git-cliff 2.11.0 似乎确实如此……)

之前给git-cliff指定了--unreleased。原以为git cliff --unreleased等于git cliff结果中的[unreleased]部分,实际上只是子集,具体情况要慢慢分析……

git-cliff解析历史时,会把标签分为以下 2+1 = 3 类。分类方法受ignore_tagstag_pattern两项设置影响,且CLI设置(见.github/workflows/release.yml)会覆盖cliff.toml设置(ignore_tags = ".*alpha|beta|-.*"tag_pattern未设置,相当于.*)。

  • 有效标签:匹配tag_pattern
    • 正式标签:匹配tag_pattern但不匹配ignore_tags
    • 非正式标签:匹配tag_pattern且匹配ignore_tags
  • 无效标签:不匹配tag_pattern

在changelog模板中,有三个变量相关:

  • version:当前标签,可能为null

    • 若指定了--unreleased,则为null
    • 若指定了--current,则为HEAD对应的标签
    • 若指定了--latest,则为整个历史中的最新标签

    用 release.published 事件触发 GitHub Actions 时,release 对应的标签已经创建了,所以--latest--current效果相同。

  • previous.version:上一正式标签

  • commits:从上一有效标签到当前标签的提交记录

    对于当前标签为null的情况,上一有效标签就是HEAD。

以上理论可以解释目前所有现象。

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR improves the release notes generation for pre-releases by fixing git-cliff configuration issues. Previously, pre-release versions had empty release notes due to incorrect usage of the --unreleased flag and configuration settings.

Key changes:

  • Enhanced the cliff.toml template to handle public releases, pre-releases, and testing scenarios differently
  • Updated the GitHub Actions workflow to use appropriate git-cliff flags based on release type
  • Added job summary output for better visibility of generated release notes

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
cliff.toml Added conditional logic to generate different release note headers for public releases, pre-releases, and testing; duplicated ignore_tags pattern in template to prevent CLI override
.github/workflows/release.yml Modified git-cliff arguments to use --current for releases and conditional tag filtering for public vs pre-releases; added step to output release notes to job summary

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@YDX-2147483647 YDX-2147483647 added this pull request to the merge queue Jan 7, 2026
Merged via the queue into BITNP:main with commit aae73e7 Jan 7, 2026
15 checks passed
@YDX-2147483647 YDX-2147483647 deleted the cliff branch January 7, 2026 11:09
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.

1 participant