1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-10 03:47:03 +02:00
goreleaser/pipeline/env/env.go

30 lines
564 B
Go
Raw Normal View History

2017-01-14 18:06:57 +02:00
package env
import (
"errors"
"os"
2017-01-15 00:01:32 +02:00
"github.com/goreleaser/goreleaser/context"
2017-01-14 18:06:57 +02:00
)
2017-01-14 20:41:32 +02:00
// ErrMissingToken indicates an error when GITHUB_TOKEN is missing in the environment
2017-01-14 18:06:57 +02:00
var ErrMissingToken = errors.New("Missing GITHUB_TOKEN")
// Pipe for env
type Pipe struct{}
2017-01-14 20:41:32 +02:00
// Description of the pipe
2017-01-14 19:14:35 +02:00
func (Pipe) Description() string {
return "Loading data from environment variables..."
2017-01-14 18:06:57 +02:00
}
// Run the pipe
func (Pipe) Run(ctx *context.Context) (err error) {
token := os.Getenv("GITHUB_TOKEN")
if token == "" {
return ErrMissingToken
}
ctx.Token = &token
return
}