1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-16 03:52:12 +02:00

fix: skip defaults for skipped pipes (#4210)

closes #4208

---------

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
This commit is contained in:
Carlos Alexandro Becker 2023-08-08 22:43:39 -03:00 committed by GitHub
parent c06ba3a94f
commit dccd68c126
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 2 deletions

View File

@ -8,6 +8,7 @@ import (
"github.com/goreleaser/goreleaser/internal/client"
"github.com/goreleaser/goreleaser/internal/middleware/errhandler"
"github.com/goreleaser/goreleaser/internal/middleware/skip"
"github.com/goreleaser/goreleaser/internal/tmpl"
"github.com/goreleaser/goreleaser/pkg/context"
"github.com/goreleaser/goreleaser/pkg/defaults"
@ -38,7 +39,10 @@ func (Pipe) Run(ctx *context.Context) error {
ctx.Config.GiteaURLs.Download = strings.TrimSuffix(strings.ReplaceAll(apiURL, "/api/v1", ""), "/")
}
for _, defaulter := range defaults.Defaulters {
if err := errhandler.Handle(defaulter.Default)(ctx); err != nil {
if err := skip.Maybe(
defaulter,
errhandler.Handle(defaulter.Default),
)(ctx); err != nil {
return err
}
}

View File

@ -94,6 +94,7 @@ func TestFillPartial(t *testing.T) {
require.NotEmpty(t, ctx.Config.Dockers[0].Dockerfile)
require.Equal(t, "disttt", ctx.Config.Dist)
require.NotEqual(t, "https://github.com", ctx.Config.GitHubURLs.Download)
require.Empty(t, ctx.Config.Nix, "nix should have been skipped")
ctx = testctx.NewWithCfg(config.Project{
GiteaURLs: config.GiteaURLs{

View File

@ -80,7 +80,7 @@ var Defaulters = []Defaulter{
blob.Pipe{},
upload.Pipe{},
aur.Pipe{},
nix.Pipe{},
nix.NewPublish(),
winget.Pipe{},
brew.Pipe{},
krew.Pipe{},