mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-04-15 11:56:56 +02:00
fix: accept empty GITHUB_TOKEN if release is disabled
This commit is contained in:
parent
0cdf994fb1
commit
58d8ac62ac
3
pipeline/env/env.go
vendored
3
pipeline/env/env.go
vendored
@ -38,6 +38,9 @@ func (Pipe) Run(ctx *context.Context) error {
|
|||||||
if ctx.SkipPublish {
|
if ctx.SkipPublish {
|
||||||
return pipeline.ErrSkipPublishEnabled
|
return pipeline.ErrSkipPublishEnabled
|
||||||
}
|
}
|
||||||
|
if ctx.Config.Release.Disable {
|
||||||
|
return pipeline.Skip("release pipe is disabled")
|
||||||
|
}
|
||||||
if ctx.Token == "" && err == nil {
|
if ctx.Token == "" && err == nil {
|
||||||
return ErrMissingToken
|
return ErrMissingToken
|
||||||
}
|
}
|
||||||
|
12
pipeline/env/env_test.go
vendored
12
pipeline/env/env_test.go
vendored
@ -82,6 +82,18 @@ func TestInvalidEnvChecksSkipped(t *testing.T) {
|
|||||||
testlib.AssertSkipped(t, Pipe{}.Run(ctx))
|
testlib.AssertSkipped(t, Pipe{}.Run(ctx))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestInvalidEnvReleaseDisabled(t *testing.T) {
|
||||||
|
assert.NoError(t, os.Unsetenv("GITHUB_TOKEN"))
|
||||||
|
var ctx = &context.Context{
|
||||||
|
Config: config.Project{
|
||||||
|
Release: config.Release{
|
||||||
|
Disable: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
testlib.AssertSkipped(t, Pipe{}.Run(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
func TestLoadEnv(t *testing.T) {
|
func TestLoadEnv(t *testing.T) {
|
||||||
t.Run("env exists", func(tt *testing.T) {
|
t.Run("env exists", func(tt *testing.T) {
|
||||||
var env = "SUPER_SECRET_ENV"
|
var env = "SUPER_SECRET_ENV"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user