mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-01-24 04:16:27 +02:00
fe7e2123bd
* feat: replacing logs Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com> * fix: tests et al Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com> * feat: update termenv/lipgloss Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com> * wip: output Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com> * fix: pin dep Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com> * fix: update Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com> * fix: tests Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com> * fix: tests Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com> * fix: deps Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com> * fix: dep Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
33 lines
803 B
Go
33 lines
803 B
Go
// Package skip can skip an entire Action.
|
|
package skip
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/caarlos0/log"
|
|
"github.com/goreleaser/goreleaser/internal/middleware"
|
|
"github.com/goreleaser/goreleaser/pkg/context"
|
|
)
|
|
|
|
// Skipper defines a method to skip an entire Piper.
|
|
type Skipper interface {
|
|
// Skip returns true if the Piper should be skipped.
|
|
Skip(ctx *context.Context) bool
|
|
fmt.Stringer
|
|
}
|
|
|
|
// Maybe returns an action that skips immediately if the given p is a Skipper
|
|
// and its Skip method returns true.
|
|
func Maybe(skipper interface{}, next middleware.Action) middleware.Action {
|
|
if skipper, ok := skipper.(Skipper); ok {
|
|
return func(ctx *context.Context) error {
|
|
if skipper.Skip(ctx) {
|
|
log.Debugf("skipped %s", skipper.String())
|
|
return nil
|
|
}
|
|
return next(ctx)
|
|
}
|
|
}
|
|
return next
|
|
}
|