setting the github client API url for github enterprise
This commit is contained in:
parent
30767bdfa7
commit
aec5d06ff1
2 changed files with 5 additions and 0 deletions
|
@ -23,6 +23,7 @@ func (c *Client) GetUser(login string) (*remote.User, error) {
|
||||||
func (c *Client) GetRepos(owner string) ([]*remote.Repo, error) {
|
func (c *Client) GetRepos(owner string) ([]*remote.Repo, error) {
|
||||||
// create the github client
|
// create the github client
|
||||||
client := github.New(c.access)
|
client := github.New(c.access)
|
||||||
|
client.ApiUrl = c.config.API
|
||||||
|
|
||||||
// retrieve a list of all github repositories
|
// retrieve a list of all github repositories
|
||||||
repos, err := client.Repos.ListAll()
|
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) {
|
func (c *Client) GetScript(hook *remote.Hook) (out string, err error) {
|
||||||
// create the github client
|
// create the github client
|
||||||
client := github.New(c.access)
|
client := github.New(c.access)
|
||||||
|
client.ApiUrl = c.config.API
|
||||||
|
|
||||||
// retrieve the .drone.yml file from GitHub
|
// retrieve the .drone.yml file from GitHub
|
||||||
content, err := client.Contents.FindRef(hook.Owner, hook.Repo, ".drone.yml", hook.Sha)
|
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 {
|
func (c *Client) SetStatus(owner, name, sha, status string) error {
|
||||||
// create the github client
|
// create the github client
|
||||||
client := github.New(c.access)
|
client := github.New(c.access)
|
||||||
|
client.ApiUrl = c.config.API
|
||||||
|
|
||||||
// convert from drone status to github status
|
// convert from drone status to github status
|
||||||
var message string
|
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 {
|
func (c *Client) SetActive(owner, name, hook, key string) error {
|
||||||
// create the github client
|
// create the github client
|
||||||
client := github.New(c.access)
|
client := github.New(c.access)
|
||||||
|
client.ApiUrl = c.config.API
|
||||||
|
|
||||||
// parse the hostname from the hook, and use this
|
// parse the hostname from the hook, and use this
|
||||||
// to name the ssh key
|
// to name the ssh key
|
||||||
|
|
|
@ -165,6 +165,7 @@ func (g *Github) GetLogin(w http.ResponseWriter, r *http.Request) (*remote.Login
|
||||||
|
|
||||||
// create the client
|
// create the client
|
||||||
client := github.New(token.AccessToken)
|
client := github.New(token.AccessToken)
|
||||||
|
client.ApiUrl = g.API
|
||||||
|
|
||||||
// get the user information
|
// get the user information
|
||||||
user, err := client.Users.Current()
|
user, err := client.Users.Current()
|
||||||
|
|
Loading…
Reference in a new issue