Skip to content

Commit c064ab9

Browse files
authored
Merge pull request #7 from fujiwara/token-env
Read GitHub token from environemnt variable when it is not set in config.
2 parents 8264fe9 + dd4b44e commit c064ab9

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

config.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package main
33
import (
44
"io"
55
"io/ioutil"
6+
"os"
67
"strings"
78

89
"github.com/kayac/go-config"
@@ -52,5 +53,9 @@ func NewConfig(r io.Reader) (Config, error) {
5253
return c, errors.Wrap(err, "cannot unmarshal config")
5354
}
5455

56+
if c.Token == "" {
57+
c.Token = os.Getenv("GITHUB_TOKEN")
58+
}
59+
5560
return c, nil
5661
}

0 commit comments

Comments
 (0)