diff --git a/config/config.go b/config/config.go index e6382e6b6..492151fad 100644 --- a/config/config.go +++ b/config/config.go @@ -194,6 +194,7 @@ type Changelog struct { Sort string `yaml:",omitempty"` } +// EnvFile is the type EnvFiles struct { GitHubToken string `yaml:"github_token,omitempty"` } diff --git a/pipeline/env/env.go b/pipeline/env/env.go index c85b8dc92..97a7345c4 100644 --- a/pipeline/env/env.go +++ b/pipeline/env/env.go @@ -52,19 +52,19 @@ func (Pipe) Run(ctx *context.Context) error { func loadEnv(env, path string) (string, error) { val := os.Getenv(env) - if val == "" { - path, err := homedir.Expand(path) - if err != nil { - return "", err - } - if _, err := os.Stat(path); os.IsNotExist(err) { - return "", nil - } - bts, err := ioutil.ReadFile(path) - if err != nil { - return "", err - } - val = string(bts) + if val != "" { + return val, nil } - return val, nil + path, err := homedir.Expand(path) + if err != nil { + return "", err + } + if _, err := os.Stat(path); os.IsNotExist(err) { + return "", nil + } + bts, err := ioutil.ReadFile(path) + if err != nil { + return "", err + } + return string(bts), nil }