You've already forked goreleaser
mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-11-06 09:09:29 +02:00
feat: deprecated changelog.skip in favor of changelog.disable
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
This commit is contained in:
@@ -12,6 +12,7 @@ import (
|
||||
|
||||
"github.com/caarlos0/log"
|
||||
"github.com/goreleaser/goreleaser/internal/client"
|
||||
"github.com/goreleaser/goreleaser/internal/deprecate"
|
||||
"github.com/goreleaser/goreleaser/internal/git"
|
||||
"github.com/goreleaser/goreleaser/internal/tmpl"
|
||||
"github.com/goreleaser/goreleaser/pkg/context"
|
||||
@@ -43,7 +44,12 @@ func (Pipe) Skip(ctx *context.Context) (bool, error) {
|
||||
if ctx.Snapshot {
|
||||
return true, nil
|
||||
}
|
||||
return tmpl.New(ctx).Bool(ctx.Config.Changelog.Skip)
|
||||
if ctx.Config.Changelog.Skip != "" {
|
||||
deprecate.Notice(ctx, "changelog.skip")
|
||||
ctx.Config.Changelog.Disable = ctx.Config.Changelog.Skip
|
||||
}
|
||||
|
||||
return tmpl.New(ctx).Bool(ctx.Config.Changelog.Disable)
|
||||
}
|
||||
|
||||
// Run the pipe.
|
||||
|
||||
@@ -682,7 +682,7 @@ func TestSkip(t *testing.T) {
|
||||
require.True(t, b)
|
||||
})
|
||||
|
||||
t.Run("skip on patches", func(t *testing.T) {
|
||||
t.Run("skip/disable", func(t *testing.T) {
|
||||
ctx := testctx.NewWithCfg(config.Project{
|
||||
Changelog: config.Changelog{
|
||||
Skip: "{{gt .Patch 0}}",
|
||||
@@ -691,12 +691,24 @@ func TestSkip(t *testing.T) {
|
||||
b, err := Pipe{}.Skip(ctx)
|
||||
require.NoError(t, err)
|
||||
require.True(t, b)
|
||||
require.Equal(t, ctx.Config.Changelog.Skip, ctx.Config.Changelog.Disable)
|
||||
})
|
||||
|
||||
t.Run("disable on patches", func(t *testing.T) {
|
||||
ctx := testctx.NewWithCfg(config.Project{
|
||||
Changelog: config.Changelog{
|
||||
Disable: "{{gt .Patch 0}}",
|
||||
},
|
||||
}, testctx.WithSemver(0, 0, 1, ""))
|
||||
b, err := Pipe{}.Skip(ctx)
|
||||
require.NoError(t, err)
|
||||
require.True(t, b)
|
||||
})
|
||||
|
||||
t.Run("invalid template", func(t *testing.T) {
|
||||
ctx := testctx.NewWithCfg(config.Project{
|
||||
Changelog: config.Changelog{
|
||||
Skip: "{{if eq .Patch 123}",
|
||||
Disable: "{{if eq .Patch 123}",
|
||||
},
|
||||
}, testctx.WithSemver(0, 0, 1, ""))
|
||||
_, err := Pipe{}.Skip(ctx)
|
||||
@@ -712,7 +724,7 @@ func TestSkip(t *testing.T) {
|
||||
t.Run("dont skip based on template", func(t *testing.T) {
|
||||
ctx := testctx.NewWithCfg(config.Project{
|
||||
Changelog: config.Changelog{
|
||||
Skip: "{{gt .Patch 0}}",
|
||||
Disable: "{{gt .Patch 0}}",
|
||||
},
|
||||
})
|
||||
b, err := Pipe{}.Skip(ctx)
|
||||
|
||||
@@ -1065,10 +1065,13 @@ type Filters struct {
|
||||
type Changelog struct {
|
||||
Filters Filters `yaml:"filters,omitempty" json:"filters,omitempty"`
|
||||
Sort string `yaml:"sort,omitempty" json:"sort,omitempty" jsonschema:"enum=asc,enum=desc,enum=,default="`
|
||||
Skip string `yaml:"skip,omitempty" json:"skip,omitempty" jsonschema:"oneof_type=string;boolean"` // TODO(caarlos0): rename to Disable to match other pipes
|
||||
Disable string `yaml:"disable,omitempty" json:"disable,omitempty" jsonschema:"oneof_type=string;boolean"`
|
||||
Use string `yaml:"use,omitempty" json:"use,omitempty" jsonschema:"enum=git,enum=github,enum=github-native,enum=gitlab,default=git"`
|
||||
Groups []ChangelogGroup `yaml:"groups,omitempty" json:"groups,omitempty"`
|
||||
Abbrev int `yaml:"abbrev,omitempty" json:"abbrev,omitempty"`
|
||||
|
||||
// Deprecated: use disable instead.
|
||||
Skip string `yaml:"skip,omitempty" json:"skip,omitempty" jsonschema:"oneof_type=string;boolean,deprecated=true,description=use disable_disable instead"` // TODO(caarlos0): rename to Disable to match other pipes
|
||||
}
|
||||
|
||||
// ChangelogGroup holds the grouping criteria for the changelog.
|
||||
|
||||
@@ -13,7 +13,7 @@ changelog:
|
||||
# This may result in an empty release notes on GitHub/GitLab/Gitea.
|
||||
#
|
||||
# Templates: allowed
|
||||
skip: "{{ .Env.CREATE_CHANGELOG }}"
|
||||
disable: "{{ .Env.CREATE_CHANGELOG }}"
|
||||
|
||||
# Changelog generation implementation to use.
|
||||
#
|
||||
|
||||
@@ -39,6 +39,26 @@ Description.
|
||||
|
||||
-->
|
||||
|
||||
### changelog.skip
|
||||
|
||||
> since 2024-01-14
|
||||
|
||||
Changed to `disable` to conform with all other pipes.
|
||||
|
||||
=== "Before"
|
||||
|
||||
```yaml
|
||||
changelog:
|
||||
skip: true
|
||||
```
|
||||
|
||||
=== "After"
|
||||
|
||||
```yaml
|
||||
changelog:
|
||||
disable: true
|
||||
```
|
||||
|
||||
### blobs.kmskey
|
||||
|
||||
> since 2024-01-07
|
||||
|
||||
Reference in New Issue
Block a user