Skip to content

Commit

Permalink
docs: changelog excludes now supports the use of regexes to improve f…
Browse files Browse the repository at this point in the history
…iltering (#274)
  • Loading branch information
ga-paul-t authored Oct 8, 2022
1 parent 488566e commit a975b5a
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 13 deletions.
4 changes: 2 additions & 2 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ uplift changelog

## Excluding Commits

You can exclude commits from the changelog by specifying a list of commit prefixes.
You can exclude commits from the changelog by specifying a list of regex. Matching against a commit prefix is the most straightforward approach to doing this.

```sh
uplift changelog --exclude chore,ci,test
uplift changelog --exclude ^chore,^ci,^test
```

## Changing the Commit Order
Expand Down
1 change: 1 addition & 0 deletions docs/reference/cli/bump.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@ uplift bump [flags]
--ignore-existing-prerelease ignore any existing prerelease when calculating next semantic version
--ignore-shallow ignore reported git shallow clone error
--no-push no changes will be pushed to the git remote
--no-stage no changes will be git staged
--silent silence all logging
```
1 change: 1 addition & 0 deletions docs/reference/cli/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@ uplift changelog [flags]
--ignore-existing-prerelease ignore any existing prerelease when calculating next semantic version
--ignore-shallow ignore reported git shallow clone error
--no-push no changes will be pushed to the git remote
--no-stage no changes will be git staged
--silent silence all logging
```
1 change: 1 addition & 0 deletions docs/reference/cli/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@ uplift release [flags]
--ignore-existing-prerelease ignore any existing prerelease when calculating next semantic version
--ignore-shallow ignore reported git shallow clone error
--no-push no changes will be pushed to the git remote
--no-stage no changes will be git staged
--silent silence all logging
```
1 change: 1 addition & 0 deletions docs/reference/cli/root.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ uplift [command]
--ignore-existing-prerelease ignore any existing prerelease when calculating next semantic version
--ignore-shallow ignore reported git shallow clone error
--no-push no changes will be pushed to the git remote
--no-stage no changes will be git staged
--silent silence all logging
```

Expand Down
1 change: 1 addition & 0 deletions docs/reference/cli/tag.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@ uplift tag [flags]
--ignore-existing-prerelease ignore any existing prerelease when calculating next semantic version
--ignore-shallow ignore reported git shallow clone error
--no-push no changes will be pushed to the git remote
--no-stage no changes will be git staged
--silent silence all logging
```
14 changes: 7 additions & 7 deletions docs/reference/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,15 @@ changelog:
sort: asc
# A list of commits to exclude during the creation of a changelog.
# Provide a list of conventional commit prefixes to filter on.
# Auto-generated commits from Uplift (with the prefix ci(uplift)) will
# always be excluded
# Provide a list of regular expressions for matching commits that
# are to be excluded. Auto-generated commits from Uplift
# (with the prefix ci(uplift)) will always be excluded
#
# Defaults to including all commits within the generated changelog
# Defaults to an empty list. All commits are included
exclude:
- chore(deps)
- docs
- ci
- '^chore\(deps\)'
- ^docs
- ^ci
```

## bumps
Expand Down
2 changes: 1 addition & 1 deletion docs/static/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
},
"exclude": {
"$comment": "https://upliftci.dev/reference/config#changelog",
"description": "A list of commits to exclude during the creation of a changelog. Provide a list of conventional commit prefixes to filter on. Auto-generated commits from Uplift (with the prefix ci(uplift)) will always be excluded",
"description": "A list of commits to exclude during the creation of a changelog. Provide a list of regular expressions for matching commits that are to be excluded. Auto-generated commits from Uplift (with the prefix ci(uplift)) will always be excluded",
"items": {
"type": "string"
},
Expand Down
6 changes: 3 additions & 3 deletions internal/task/changelog/changelog_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,14 +334,14 @@ func TestRun_NoLogEntries(t *testing.T) {
func TestRun_WithExcludes(t *testing.T) {
git.InitRepo(t)
git.Tag("1.0.0")
h := git.EmptyCommitsAndTag(t, "1.1.0", "first commit", "exclude: second commit", "third commit", "ignore: forth commit")
h := git.EmptyCommitsAndTag(t, "1.1.0", "first commit", "exclude(scope): second commit", "third commit", "ignore: forth commit")

var buf bytes.Buffer
ctx := &context.Context{
Out: &buf,
Changelog: context.Changelog{
DiffOnly: true,
Exclude: []string{"exclude", "ignore"},
Exclude: []string{`^exclude\(scope\)`, "ignore:"},
},
CurrentVersion: semver.Version{
Raw: "1.0.0",
Expand Down Expand Up @@ -483,7 +483,7 @@ func TestRun_AllWithExcludes(t *testing.T) {
ctx := &context.Context{
Changelog: context.Changelog{
All: true,
Exclude: []string{"refactor"},
Exclude: []string{"^refactor:"},
},
SCM: context.SCM{
Provider: git.Unrecognised,
Expand Down

0 comments on commit a975b5a

Please sign in to comment.