1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-02-13 13:48:40 +02:00

fix: accept empty GITHUB_TOKEN if release is disabled

This commit is contained in:
Carlos Alexandro Becker 2018-05-08 21:03:21 -03:00 committed by Carlos Alexandro Becker
parent 0cdf994fb1
commit 58d8ac62ac
2 changed files with 15 additions and 0 deletions

3
pipeline/env/env.go vendored
View File

@ -38,6 +38,9 @@ func (Pipe) Run(ctx *context.Context) error {
if ctx.SkipPublish {
return pipeline.ErrSkipPublishEnabled
}
if ctx.Config.Release.Disable {
return pipeline.Skip("release pipe is disabled")
}
if ctx.Token == "" && err == nil {
return ErrMissingToken
}

View File

@ -82,6 +82,18 @@ func TestInvalidEnvChecksSkipped(t *testing.T) {
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) {
t.Run("env exists", func(tt *testing.T) {
var env = "SUPER_SECRET_ENV"