Update all github clients in code
This commit is contained in:
parent
425cbbc324
commit
44d5f3baca
2 changed files with 11 additions and 0 deletions
|
@ -100,8 +100,13 @@ func Hook(w http.ResponseWriter, r *http.Request) error {
|
|||
commit.SetAuthor(hook.Commits[0].Author.Email)
|
||||
}
|
||||
|
||||
// get the github settings from the database
|
||||
settings := database.SettingsMust()
|
||||
|
||||
// get the drone.yml file from GitHub
|
||||
client := github.New(user.GithubToken)
|
||||
client.ApiUrl = settings.GitHubApiUrl
|
||||
|
||||
content, err := client.Contents.FindRef(repo.Owner, repo.Name, ".drone.yml", commit.Hash)
|
||||
if err != nil {
|
||||
msg := "No .drone.yml was found in this repository. You need to add one.\n"
|
||||
|
@ -216,8 +221,13 @@ func PullRequestHook(w http.ResponseWriter, r *http.Request) {
|
|||
commit.Message = hook.PullRequest.Title
|
||||
// label := p.PullRequest.Head.Labe
|
||||
|
||||
// get the github settings from the database
|
||||
settings := database.SettingsMust()
|
||||
|
||||
// get the drone.yml file from GitHub
|
||||
client := github.New(user.GithubToken)
|
||||
client.ApiUrl = settings.GitHubApiUrl
|
||||
|
||||
content, err := client.Contents.FindRef(repo.Owner, repo.Name, ".drone.yml", commit.Hash) // TODO should this really be the hash??
|
||||
if err != nil {
|
||||
println(err.Error())
|
||||
|
|
|
@ -82,6 +82,7 @@ func RepoCreateGithub(w http.ResponseWriter, r *http.Request, u *User) error {
|
|||
|
||||
// create the GitHub client
|
||||
client := github.New(u.GithubToken)
|
||||
client.ApiUrl = settings.GitHubApiUrl
|
||||
githubRepo, err := client.Repos.Find(owner, name)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
Loading…
Reference in a new issue