1
0
mirror of https://github.com/woodpecker-ci/woodpecker.git synced 2024-12-24 10:07:21 +02:00

Update all github clients in code

This commit is contained in:
Vsevolod Strukchinsky 2014-02-09 19:59:51 +06:00
parent 425cbbc324
commit 44d5f3baca
2 changed files with 11 additions and 0 deletions

View File

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

View File

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