Skip to content

Commit

Permalink
Merge pull request #149 from walter-cd/add-baseurl
Browse files Browse the repository at this point in the history
Add BaseUrl to support GitHub Enterprise
  • Loading branch information
takahi-i committed Jan 29, 2016
2 parents bc10289 + 5caaeef commit 2f559f4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion services/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ package services

import (
"container/list"
"net/url"
"regexp"

"golang.org/x/oauth2"
"github.com/google/go-github/github"
"github.com/walter-cd/walter/log"
"golang.org/x/oauth2"
)

//GitHubClient struct
Expand All @@ -34,6 +35,7 @@ type GitHubClient struct {
Token string `config:"token"`
UpdateFile string `config:"update"`
TargetBranch string `config:"branch"`
BaseUrl *url.URL
}

//GetUpdateFilePath returns the update file name
Expand All @@ -53,6 +55,10 @@ func (githubClient *GitHubClient) RegisterResult(result Result) error {
tc := oauth2.NewClient(oauth2.NoContext, ts)
client := github.NewClient(tc)

if githubClient.BaseUrl != nil {
client.BaseURL = githubClient.BaseUrl
}

log.Info("Submitting result")
repositories := client.Repositories
status, _, err := repositories.CreateStatus(
Expand Down

0 comments on commit 2f559f4

Please sign in to comment.