From aec5d06ff14becab11dafa9fa107ee2121afe7a7 Mon Sep 17 00:00:00 2001 From: Brad Rydzewski Date: Sun, 3 Aug 2014 09:55:45 -0700 Subject: [PATCH] setting the github client API url for github enterprise --- plugin/remote/github/client.go | 4 ++++ plugin/remote/github/github.go | 1 + 2 files changed, 5 insertions(+) diff --git a/plugin/remote/github/client.go b/plugin/remote/github/client.go index fd29f357..ac11455a 100644 --- a/plugin/remote/github/client.go +++ b/plugin/remote/github/client.go @@ -23,6 +23,7 @@ func (c *Client) GetUser(login string) (*remote.User, error) { func (c *Client) GetRepos(owner string) ([]*remote.Repo, error) { // create the github client client := github.New(c.access) + client.ApiUrl = c.config.API // retrieve a list of all github repositories repos, err := client.Repos.ListAll() @@ -71,6 +72,7 @@ func (c *Client) GetRepos(owner string) ([]*remote.Repo, error) { func (c *Client) GetScript(hook *remote.Hook) (out string, err error) { // create the github client client := github.New(c.access) + client.ApiUrl = c.config.API // retrieve the .drone.yml file from GitHub content, err := client.Contents.FindRef(hook.Owner, hook.Repo, ".drone.yml", hook.Sha) @@ -91,6 +93,7 @@ func (c *Client) GetScript(hook *remote.Hook) (out string, err error) { func (c *Client) SetStatus(owner, name, sha, status string) error { // create the github client client := github.New(c.access) + client.ApiUrl = c.config.API // convert from drone status to github status var message string @@ -127,6 +130,7 @@ func (c *Client) SetStatus(owner, name, sha, status string) error { func (c *Client) SetActive(owner, name, hook, key string) error { // create the github client client := github.New(c.access) + client.ApiUrl = c.config.API // parse the hostname from the hook, and use this // to name the ssh key diff --git a/plugin/remote/github/github.go b/plugin/remote/github/github.go index 9f39e6ef..d5a8375c 100644 --- a/plugin/remote/github/github.go +++ b/plugin/remote/github/github.go @@ -165,6 +165,7 @@ func (g *Github) GetLogin(w http.ResponseWriter, r *http.Request) (*remote.Login // create the client client := github.New(token.AccessToken) + client.ApiUrl = g.API // get the user information user, err := client.Users.Current()