From 41acec25c452cbea1592bab7cb0de8ef42f548d8 Mon Sep 17 00:00:00 2001 From: Fabian Ruff Date: Fri, 27 Apr 2018 16:57:14 +0200 Subject: [PATCH 1/2] Do not require GITHUB_TOKEN for enterprise setups Not sure why this was added but using no token works for our GitHub enterprise installation. --- selfupdate/updater.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/selfupdate/updater.go b/selfupdate/updater.go index 0df94d6..322d469 100644 --- a/selfupdate/updater.go +++ b/selfupdate/updater.go @@ -2,7 +2,6 @@ package selfupdate import ( "context" - "errors" "net/http" "os" @@ -56,9 +55,6 @@ func NewUpdater(config Config) (*Updater, error) { return &Updater{client, ctx}, nil } - if token == "" { - return nil, errors.New("GitHub API token cannot be empty when releases are hosted on GitHub Enterprise instance") - } u := config.EnterpriseUploadURL if u == "" { u = config.EnterpriseBaseURL From 967270aa693ee1683df50a9d52d550f58aee7075 Mon Sep 17 00:00:00 2001 From: rhysd Date: Sun, 20 May 2018 21:49:09 +0900 Subject: [PATCH 2/2] remove TestGitHubEnterpriseClientWithoutToken which is no longer valid due to 41acec2 --- selfupdate/updater_test.go | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/selfupdate/updater_test.go b/selfupdate/updater_test.go index ad06677..9eef513 100644 --- a/selfupdate/updater_test.go +++ b/selfupdate/updater_test.go @@ -61,16 +61,6 @@ func TestGitHubEnterpriseClient(t *testing.T) { } } -func TestGitHubEnterpriseClientWithoutToken(t *testing.T) { - token := os.Getenv("GITHUB_TOKEN") - defer os.Setenv("GITHUB_TOKEN", token) - os.Setenv("GITHUB_TOKEN", "") - _, err := NewUpdater(Config{EnterpriseBaseURL: "https://github.company.com/api/v3/"}) - if err == nil { - t.Fatal("Error should be reported because of empty token") - } -} - func TestGitHubEnterpriseClientInvalidURL(t *testing.T) { _, err := NewUpdater(Config{APIToken: "hogehoge", EnterpriseBaseURL: ":this is not a URL"}) if err == nil {