Skip to content

Commit

Permalink
feat: --skip=scoop
Browse files Browse the repository at this point in the history
  • Loading branch information
caarlos0 committed Nov 3, 2023
1 parent 8cd3104 commit 8ce4399
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion internal/pipe/scoop/scoop.go
Expand Up @@ -17,6 +17,7 @@ import (
"github.com/goreleaser/goreleaser/internal/commitauthor"
"github.com/goreleaser/goreleaser/internal/deprecate"
"github.com/goreleaser/goreleaser/internal/pipe"
"github.com/goreleaser/goreleaser/internal/skips"
"github.com/goreleaser/goreleaser/internal/tmpl"
"github.com/goreleaser/goreleaser/pkg/config"
"github.com/goreleaser/goreleaser/pkg/context"
Expand Down Expand Up @@ -62,7 +63,7 @@ type Pipe struct{}
func (Pipe) String() string { return "scoop manifests" }
func (Pipe) ContinueOnError() bool { return true }
func (Pipe) Skip(ctx *context.Context) bool {
return ctx.Config.Scoop.Repository.Name == "" && len(ctx.Config.Scoops) == 0
return skips.Any(ctx, skips.Scoop) || (ctx.Config.Scoop.Repository.Name == "" && len(ctx.Config.Scoops) == 0)
}

// Run creates the scoop manifest locally.
Expand Down
2 changes: 2 additions & 0 deletions internal/pipe/scoop/scoop_test.go
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/goreleaser/goreleaser/internal/artifact"
"github.com/goreleaser/goreleaser/internal/client"
"github.com/goreleaser/goreleaser/internal/golden"
"github.com/goreleaser/goreleaser/internal/skips"
"github.com/goreleaser/goreleaser/internal/testctx"
"github.com/goreleaser/goreleaser/internal/testlib"
"github.com/goreleaser/goreleaser/pkg/config"
Expand Down Expand Up @@ -1101,6 +1102,7 @@ func TestWrapInDirectory(t *testing.T) {
func TestSkip(t *testing.T) {
t.Run("skip", func(t *testing.T) {
require.True(t, Pipe{}.Skip(testctx.New()))
require.True(t, Pipe{}.Skip(testctx.New(testctx.Skip(skips.Scoop))))
})

t.Run("dont skip", func(t *testing.T) {
Expand Down
2 changes: 2 additions & 0 deletions internal/skips/skips.go
Expand Up @@ -23,6 +23,7 @@ const (
Ko Key = "ko"
Docker Key = "docker"
Before Key = "before"
Scoop Key = "scoop"
)

func String(ctx *context.Context) string {
Expand Down Expand Up @@ -97,6 +98,7 @@ var Release = Keys{
SBOM,
Ko,
Docker,
Scoop,
Before,
}

Expand Down

0 comments on commit 8ce4399

Please sign in to comment.