mirror of
https://github.com/harness/drone.git
synced 2025-05-09 04:11:01 +08:00
Update all github clients in code
This commit is contained in:
parent
425cbbc324
commit
44d5f3baca
@ -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 New Issue
Block a user