Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support github.token in gitconfig #8

Merged
merged 2 commits into from
Oct 29, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,19 @@ Run it in your project directory:
$ ghr [option] <tag> <artifacts>
```

You need to set `GITHUB_TOKEN` environmental variable:
You need to set `GITHUB_TOKEN` environmental variable or `github.token` in gitconfig:
Enviromental variable takes priority over gitconfig value.

```bash
$ export GITHUB_TOKEN="....."
```

```
[github]
token = "....."
```


## Example

To upload all package in `pkg` directory with tag `v0.1.0`
Expand Down
9 changes: 6 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,11 @@ func ghrMain() int {
if *token == "" {
*token = os.Getenv("GITHUB_TOKEN")
if *token == "" {
fmt.Fprintf(os.Stderr, "Please set your Github API Token in the GITHUB_TOKEN env var\n")
return 1
*token, _ = gitconfig.GithubToken()
if *token == "" {
fmt.Fprintf(os.Stderr, "Please set your Github API Token in the GITHUB_TOKEN env var\n")
return 1
}
}
}

Expand Down Expand Up @@ -264,7 +267,7 @@ Options:
 --replace Replace asset if target already exists
 --delete Delete release if same version exists
--draft Create unpublised release
--prerelease Create prerelease
--prerelease Create prerelease
-h, --help Print this message and quit
-v, --version Print version information and quit
--debug=false Run as DEBUG mode
Expand Down