File tree Expand file tree Collapse file tree 8 files changed +82
-1
lines changed
fixtures/test-cli-arg-ignore-tags Expand file tree Collapse file tree 8 files changed +82
-1
lines changed Original file line number Diff line number Diff line change
1
+ [changelog ]
2
+ # changelog header
3
+ header = """
4
+ # Changelog\n
5
+ All notable changes to this project will be documented in this file.\n
6
+ """
7
+ # template for the changelog body
8
+ # https://keats.github.io/tera/docs/#introduction
9
+ body = """
10
+ {% if version %}\
11
+ ## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
12
+ {% else %}\
13
+ ## [unreleased]
14
+ {% endif %}\
15
+ {% for group, commits in commits | group_by(attribute="group") %}
16
+ ### {{ group | upper_first }}
17
+ {% for commit in commits %}
18
+ - {% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message | upper_first }}\
19
+ {% endfor %}
20
+ {% endfor %}\n
21
+ """
22
+ # template for the changelog footer
23
+ footer = """
24
+ <!-- generated by git-cliff -->
25
+ """
26
+ # remove the leading and trailing whitespace from the templates
27
+ trim = true
28
+
29
+ [git ]
30
+ # regex for skipping tags
31
+ skip_tags = " "
32
+ # regex for ignoring tags
33
+ ignore_tags = " "
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+ set -e
3
+
4
+ GIT_COMMITTER_DATE=" 2021-01-23 01:23:45" git commit --allow-empty -m " feat: add first beta feature"
5
+ git tag v1.0.0-beta.1
6
+
7
+ GIT_COMMITTER_DATE=" 2021-01-23 01:23:46" git commit --allow-empty -m " feat: add second beta feature"
8
+ git tag v1.0.0-beta.2
9
+
10
+ # WARNING: If we won't create this commit, 1.0.0 won't be created!
11
+ GIT_COMMITTER_DATE=" 2021-01-23 01:23:47" git commit --allow-empty -m " chore: why do i need a commit here?"
12
+ git tag v1.0.0
13
+
14
+ GIT_COMMITTER_DATE=" 2021-01-23 01:23:49" git commit --allow-empty -m " fix: simple fix"
15
+ git tag v1.0.1
Original file line number Diff line number Diff line change
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ ## [ 1.0.1] - 2021-01-23
6
+
7
+ ### Fix
8
+
9
+ - Simple fix
10
+
11
+ ## [ 1.0.0] - 2021-01-23
12
+
13
+ ### Chore
14
+
15
+ - Why do i need a commit here?
16
+
17
+ ### Feat
18
+
19
+ - Add first beta feature
20
+ - Add second beta feature
21
+
22
+ <!-- generated by git-cliff -->
Original file line number Diff line number Diff line change 77
77
command : --bump
78
78
- fixtures-name : test-bump-initial-tag-cli-arg
79
79
command : --bump --tag=2.1.1
80
+ - fixtures-name : test-cli-arg-ignore-tags
81
+ command : --ignore-tags ".*beta"
82
+
80
83
steps :
81
84
- name : Checkout
82
85
uses : actions/checkout@v4
Original file line number Diff line number Diff line change @@ -142,6 +142,9 @@ pub struct Opt {
142
142
num_args( 1 ..)
143
143
) ]
144
144
pub with_commit : Option < Vec < String > > ,
145
+ /// Sets the tags to ignore in the changelog.
146
+ #[ arg( long, env = "GIT_CLIFF_IGNORE_TAGS" , value_name = "PATTERN" ) ]
147
+ pub ignore_tags : Option < Regex > ,
145
148
/// Sets commits that will be skipped in the changelog.
146
149
#[ arg(
147
150
long,
Original file line number Diff line number Diff line change @@ -489,7 +489,9 @@ pub fn run(mut args: Opt) -> Result<()> {
489
489
if args. tag . is_some ( ) {
490
490
config. bump . initial_tag . clone_from ( & args. tag ) ;
491
491
}
492
-
492
+ if args. ignore_tags . is_some ( ) {
493
+ config. git . ignore_tags . clone_from ( & args. ignore_tags ) ;
494
+ }
493
495
// Process the repositories.
494
496
let repositories = args. repository . clone ( ) . unwrap_or ( vec ! [ env:: current_dir( ) ?] ) ;
495
497
let mut releases = Vec :: < Release > :: new ( ) ;
Original file line number Diff line number Diff line change @@ -197,6 +197,8 @@ A regex for skip processing the matched tags.
197
197
198
198
A regex for ignore processing the matched tags.
199
199
200
+ This value can be also overridden with using the ` --ignore-tags ` argument.
201
+
200
202
While ` skip_tags ` drop commits from the changelog, ` ignore_tags ` include ignored commits into the next tag.
201
203
202
204
### topo_order
Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ git-cliff [FLAGS] [OPTIONS] [--] [RANGE]
35
35
--exclude-path <PATTERN>... Sets the path to exclude related commits [env: GIT_CLIFF_EXCLUDE_PATH=]
36
36
--tag-pattern <PATTERN> Sets the regex for matching git tags [env: GIT_CLIFF_TAG_PATTERN=]
37
37
--with-commit <MSG>... Sets custom commit messages to include in the changelog [env: GIT_CLIFF_WITH_COMMIT=]
38
+ --ignore-tags <PATTERN> Sets the tags to ignore in the changelog [env: GIT_CLIFF_IGNORE_TAGS=]
38
39
--skip-commit <SHA1>... Sets commits that will be skipped in the changelog [env: GIT_CLIFF_SKIP_COMMIT=]
39
40
-p, --prepend <PATH> Prepends entries to the given changelog file [env: GIT_CLIFF_PREPEND=]
40
41
-o, --output [<PATH>] Writes output to the given file [env: GIT_CLIFF_OUTPUT=]
You can’t perform that action at this time.
0 commit comments