1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-03-17 20:47:50 +02:00

fix(skips): print all steps that will be skipped

This commit is contained in:
Carlos Alexandro Becker 2023-09-20 15:03:15 +00:00
parent 7e638371fd
commit 08d63aa5ff
No known key found for this signature in database
GPG Key ID: E61E2F7DC14AB940
2 changed files with 17 additions and 0 deletions

View File

@ -8,6 +8,7 @@ import (
"github.com/caarlos0/ctrlc"
"github.com/caarlos0/log"
"github.com/goreleaser/goreleaser/internal/deprecate"
"github.com/goreleaser/goreleaser/internal/logext"
"github.com/goreleaser/goreleaser/internal/middleware/errhandler"
"github.com/goreleaser/goreleaser/internal/middleware/logging"
"github.com/goreleaser/goreleaser/internal/middleware/skip"
@ -238,5 +239,10 @@ func setupReleaseContext(ctx *context.Context, options releaseOpts) error {
if skips.Any(ctx, skips.Publish) {
skips.Set(ctx, skips.Announce)
}
log.Warnf(
logext.Warning("skipping %s..."),
skips.String(ctx),
)
return nil
}

View File

@ -6,6 +6,7 @@ import (
"strings"
"github.com/goreleaser/goreleaser/pkg/context"
"golang.org/x/exp/maps"
"golang.org/x/exp/slices"
)
@ -24,6 +25,16 @@ const (
Before Key = "before"
)
func String(ctx *context.Context) string {
keys := maps.Keys(ctx.Skips)
sort.Strings(keys)
str := strings.Join(keys, ", ")
if idx := strings.LastIndex(str, ","); idx > -1 {
str = str[:idx] + " and" + str[idx+1:]
}
return str
}
func Any(ctx *context.Context, keys ...Key) bool {
for _, key := range keys {
if ctx.Skips[string(key)] {