diff --git a/_site/content/posts/modules/github.md b/_site/content/posts/modules/github.md
index b5a39bc0..f1339488 100644
--- a/_site/content/posts/modules/github.md
+++ b/_site/content/posts/modules/github.md
@@ -23,10 +23,15 @@ All open pull requests created by you.
wtf/github/
```
-## Required ENV Variables
+## Github Required ENV Variables
Key: `WTF_GITHUB_TOKEN`
-Action: Your Github API token or Github Enterprise API token.
+Action: Your Github API token.
+
+## GitHub Enterprise Required ENV Variables
+
+Key: `WTF_GITHUB_TOKEN`
+Action: Your Github API token.
Key: `WTF_GITHUB_BASE_URL`
Action: Your Github Enterprise API URL.
diff --git a/github/github_repo.go b/github/github_repo.go
index 532273d0..af2db77e 100644
--- a/github/github_repo.go
+++ b/github/github_repo.go
@@ -63,6 +63,16 @@ func (repo *GithubRepo) StarCount() int {
/* -------------------- Unexported Functions -------------------- */
+func (repo *GithubRepo) isGitHubEnterprise() bool {
+ if len(repo.baseURL) > 0 {
+ if len(repo.uploadURL) == 0 {
+ repo.uploadURL = repo.baseURL
+ }
+ return true
+ }
+ return false
+}
+
func (repo *GithubRepo) oauthClient() *http.Client {
tokenService := oauth2.StaticTokenSource(
&oauth2.Token{AccessToken: repo.apiKey},
@@ -74,11 +84,8 @@ func (repo *GithubRepo) oauthClient() *http.Client {
func (repo *GithubRepo) githubClient() (*ghb.Client, error) {
oauthClient := repo.oauthClient()
- if len(repo.baseURL) > 0 {
- if len(repo.uploadURL) == 0 {
- repo.uploadURL = repo.baseURL
- }
- return ghb.NewEnterpriseClient(repo.baseURL, repo.baseURL, oauthClient)
+ if repo.isGitHubEnterprise() {
+ return ghb.NewEnterpriseClient(repo.baseURL, repo.uploadURL, oauthClient)
}
return ghb.NewClient(oauthClient), nil