mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-02-18 12:25:14 +00:00
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)
|
commit.SetAuthor(hook.Commits[0].Author.Email)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// get the github settings from the database
|
||||||
|
settings := database.SettingsMust()
|
||||||
|
|
||||||
// get the drone.yml file from GitHub
|
// get the drone.yml file from GitHub
|
||||||
client := github.New(user.GithubToken)
|
client := github.New(user.GithubToken)
|
||||||
|
client.ApiUrl = settings.GitHubApiUrl
|
||||||
|
|
||||||
content, err := client.Contents.FindRef(repo.Owner, repo.Name, ".drone.yml", commit.Hash)
|
content, err := client.Contents.FindRef(repo.Owner, repo.Name, ".drone.yml", commit.Hash)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
msg := "No .drone.yml was found in this repository. You need to add one.\n"
|
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
|
commit.Message = hook.PullRequest.Title
|
||||||
// label := p.PullRequest.Head.Labe
|
// label := p.PullRequest.Head.Labe
|
||||||
|
|
||||||
|
// get the github settings from the database
|
||||||
|
settings := database.SettingsMust()
|
||||||
|
|
||||||
// get the drone.yml file from GitHub
|
// get the drone.yml file from GitHub
|
||||||
client := github.New(user.GithubToken)
|
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??
|
content, err := client.Contents.FindRef(repo.Owner, repo.Name, ".drone.yml", commit.Hash) // TODO should this really be the hash??
|
||||||
if err != nil {
|
if err != nil {
|
||||||
println(err.Error())
|
println(err.Error())
|
||||||
|
|
|
@ -82,6 +82,7 @@ func RepoCreateGithub(w http.ResponseWriter, r *http.Request, u *User) error {
|
||||||
|
|
||||||
// create the GitHub client
|
// create the GitHub client
|
||||||
client := github.New(u.GithubToken)
|
client := github.New(u.GithubToken)
|
||||||
|
client.ApiUrl = settings.GitHubApiUrl
|
||||||
githubRepo, err := client.Repos.Find(owner, name)
|
githubRepo, err := client.Repos.Find(owner, name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in a new issue