File tree Expand file tree Collapse file tree 2 files changed +25
-2
lines changed
Expand file tree Collapse file tree 2 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -182,10 +182,21 @@ jobs:
182182 id : git-cliff
183183 with :
184184 config : cliff.toml
185- args : -vv ${{ github.event.release.prerelease && '--unreleased' || '--latest' }} --strip header
185+ # Partially override cliff.toml to generate better release notes.
186+ # - For public releases, show changes since the last _public_ release.
187+ # - For pre-releases, show changes since the last release (either public or pre-release).
188+ # - For testing (workflow_dispatch), show changes not belonging to any release.
189+ args : >-
190+ -vv
191+ --strip header
192+ ${{ github.event_name == 'release' && '--current' || '--unreleased' }}
193+ ${{ github.event_name == 'release' && (github.event.release.prerelease && '--ignore-tags ""' || '--tag-pattern ''^v\d+\.\d+\.\d+$''') }}
186194 env :
187195 OUTPUT : CHANGES.md
188196 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
197+ - name : Write release notes to the job summary
198+ run : |
199+ cat CHANGES.md >> "$GITHUB_STEP_SUMMARY"
189200
190201 - uses : actions/checkout@v6
191202
Original file line number Diff line number Diff line change @@ -26,9 +26,21 @@ body = """
2626 https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}
2727{%- endmacro -%}
2828
29- {% if version %}\
29+ {#- Same as git.ignore_tags in cliff.toml, but won't be overridden from CLI -#}
30+ {%- set ignore_tags = ".*alpha|beta|-.*" -%}
31+
32+ {% if version and version is not matching(ignore_tags) %}\
33+ {#- when generating CHANGELOG.md or release notes for _public_ releases #}\
3034 ## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d", timezone="Asia/Shanghai") }}
35+ {% elif version %}\
36+ {#- when generating release notes for _pre_-releases #}\
37+ ## [unreleased]
38+
39+ The following are new unreleased changes \
40+ introduced in [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d", timezone="Asia/Shanghai") }} \
41+ compared to [{{ previous.version | trim_start_matches(pat="v") }}] - {{ previous.timestamp | date(format="%Y-%m-%d", timezone="Asia/Shanghai") }}.
3142{% else %}\
43+ {#- when testing #}\
3244 ## [unreleased]
3345{% endif %}\
3446{% for group, commits in commits | unique(attribute="id") | group_by(attribute="group") %}
You can’t perform that action at this time.
0 commit comments