mirror of
https://github.com/MedzikUser/go-github-selfupdate.git
synced 2024-08-15 03:25:29 +00:00
support tcnksm/go-gitconfig.GithubToken()
This commit is contained in:
parent
cee0f07401
commit
179b999395
1 changed files with 8 additions and 3 deletions
|
@ -3,14 +3,16 @@ package selfupdate
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/blang/semver"
|
||||
"github.com/google/go-github/github"
|
||||
"golang.org/x/oauth2"
|
||||
"net/http"
|
||||
"os"
|
||||
"regexp"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
"github.com/blang/semver"
|
||||
"github.com/google/go-github/github"
|
||||
gitconfig "github.com/tcnksm/go-gitconfig"
|
||||
"golang.org/x/oauth2"
|
||||
)
|
||||
|
||||
var reVersion = regexp.MustCompile(`\d+\.\d+\.\d+`)
|
||||
|
@ -65,6 +67,9 @@ func findSuitableReleaseAndAsset(rels []*github.RepositoryRelease) (*github.Repo
|
|||
// NewDetector crates a new detector instance. It initializes GitHub API client.
|
||||
func NewDetector() *ReleaseDetector {
|
||||
token := os.Getenv("GITHUB_TOKEN")
|
||||
if token == "" {
|
||||
token, _ = gitconfig.GithubToken()
|
||||
}
|
||||
ctx := context.Background()
|
||||
|
||||
var auth *http.Client
|
||||
|
|
Loading…
Reference in a new issue