Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitHub Enterprise Support #23

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update all github clients in code
  • Loading branch information
floatdrop committed Feb 14, 2014
commit 0c1a5cfe318e9144360dc25ac1babe8e6842dd1f
10 changes: 10 additions & 0 deletions pkg/handler/hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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())
Expand Down
1 change: 1 addition & 0 deletions pkg/handler/repos.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down