Skip to content
Permalink
Browse files

fix: accept empty GITHUB_TOKEN if release is disabled

  • Loading branch information...
caarlos0 committed May 9, 2018
1 parent 0cdf994 commit 58d8ac62acd149d7fa8307c385fb405427d1f73b
Showing with 15 additions and 0 deletions.
  1. +3 −0 pipeline/env/env.go
  2. +12 −0 pipeline/env/env_test.go
@@ -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
}
@@ -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"

0 comments on commit 58d8ac6

Please sign in to comment.
You can’t perform that action at this time.