Skip to content
Open
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
2 changes: 1 addition & 1 deletion github_release.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package selfupdate
import (
"time"

"github.com/google/go-github/v86/github"
"github.com/google/go-github/v93/github"
)

type GitHubRelease struct {
Expand Down
16 changes: 8 additions & 8 deletions github_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"os"
"strings"

"github.com/google/go-github/v86/github"
"github.com/google/go-github/v93/github"
)

// GitHubConfig is an object to pass to NewGitHubSource
Expand Down Expand Up @@ -36,27 +36,27 @@ type GitHubSource struct {
// You can pass an empty GitHubSource{} to use the default configuration
// The function will return an error if the GitHub Enterprise URLs in the config object cannot be parsed
func NewGitHubSource(config GitHubConfig) (*GitHubSource, error) {
client := github.NewClient(nil)
var opts []github.ClientOptionsFunc

token := config.APIToken
if token == "" {
// try the environment variable
token = os.Getenv("GITHUB_TOKEN")
}
if token != "" {
client = client.WithAuthToken(token)
opts = append(opts, github.WithAuthToken(token))
}

if config.EnterpriseBaseURL != "" {
uploadURL := config.EnterpriseUploadURL
if uploadURL == "" {
uploadURL = config.EnterpriseBaseURL
}
var err error
client, err = client.WithEnterpriseURLs(config.EnterpriseBaseURL, uploadURL)
if err != nil {
return nil, fmt.Errorf("cannot parse GitHub enterprise URL: %w", err)
}
opts = append(opts, github.WithEnterpriseURLs(config.EnterpriseBaseURL, uploadURL))
}
client, err := github.NewClient(opts...)
if err != nil {
return nil, fmt.Errorf("cannot parse GitHub enterprise URL: %w", err)
}
return &GitHubSource{
api: client,
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
code.gitea.io/sdk/gitea v0.25.1
github.com/Masterminds/semver/v3 v3.5.0
github.com/ProtonMail/go-crypto v1.5.2
github.com/google/go-github/v86 v86.0.0
github.com/google/go-github/v93 v93.0.0
github.com/stretchr/testify v1.12.1
github.com/ulikunitz/xz v0.5.17
gitlab.com/gitlab-org/api/client-go v1.46.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ github.com/go-fed/httpsig v1.1.0/go.mod h1:RCMrTZvN1bJYtofsG4rd5NaO5obxQ5xBkdiS7
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
github.com/google/go-github/v86 v86.0.0 h1:S/6aANJhwRm8EQmGKVML3j41yq0h2BsTP8FnDkO7kcA=
github.com/google/go-github/v86 v86.0.0/go.mod h1:zKv1l4SwDXNFMGByi2FWkq71KwSXqj/eQRZuqtmcot8=
github.com/google/go-github/v93 v93.0.0 h1:qElXPLv+XbSz1qrLdWyb0t3gSYGsWBTzr9T4/PZTCfk=
github.com/google/go-github/v93 v93.0.0/go.mod h1:l8I3rt4/mdjANKpg4Y84LEy9HJQCetUkZ8WTl2bPU8M=
github.com/google/go-querystring v1.2.0 h1:yhqkPbu2/OH+V9BfpCVPZkNmUXhb2gBxJArfhIxNtP0=
github.com/google/go-querystring v1.2.0/go.mod h1:8IFJqpSRITyJ8QhQ13bmbeMBDfmeEJZD5A0egEOmkqU=
github.com/graph-gophers/graphql-go v1.9.0 h1:yu0ucKHLc5qGpRwLYKIWtr9bOoxovkWasuBrPQwlHls=
Expand Down
Loading