setting the github client API url for github enterprise

This commit is contained in:
Brad Rydzewski 2014-08-03 09:55:45 -07:00
parent 30767bdfa7
commit aec5d06ff1
2 changed files with 5 additions and 0 deletions

View file

@ -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

View file

@ -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()