track github remote url
This commit is contained in:
parent
dc0fdbc221
commit
2465728633
3 changed files with 8 additions and 2 deletions
|
@ -230,6 +230,7 @@ func convertPullHook(from *webhook, merge bool) *model.Build {
|
|||
Author: from.PullRequest.User.Login,
|
||||
Avatar: from.PullRequest.User.Avatar,
|
||||
Title: from.PullRequest.Title,
|
||||
Remote: from.PullRequest.Head.Repo.CloneURL,
|
||||
Refspec: fmt.Sprintf(refspec,
|
||||
from.PullRequest.Head.Ref,
|
||||
from.PullRequest.Base.Ref,
|
||||
|
|
|
@ -175,6 +175,7 @@ func Test_helper(t *testing.T) {
|
|||
from.PullRequest.Base.Ref = "master"
|
||||
from.PullRequest.Head.Ref = "changes"
|
||||
from.PullRequest.Head.SHA = "f72fc19"
|
||||
from.PullRequest.Head.Repo.CloneURL = "https://github.com/octocat/hello-world-fork"
|
||||
from.PullRequest.HTMLURL = "https://github.com/octocat/hello-world/pulls/42"
|
||||
from.PullRequest.Number = 42
|
||||
from.PullRequest.Title = "Updated README.md"
|
||||
|
@ -186,6 +187,7 @@ func Test_helper(t *testing.T) {
|
|||
g.Assert(build.Branch).Equal(from.PullRequest.Head.Ref)
|
||||
g.Assert(build.Ref).Equal("refs/pull/42/merge")
|
||||
g.Assert(build.Refspec).Equal("changes:master")
|
||||
g.Assert(build.Remote).Equal("https://github.com/octocat/hello-world-fork")
|
||||
g.Assert(build.Commit).Equal(from.PullRequest.Head.SHA)
|
||||
g.Assert(build.Message).Equal(from.PullRequest.Title)
|
||||
g.Assert(build.Title).Equal(from.PullRequest.Title)
|
||||
|
|
|
@ -73,8 +73,11 @@ type webhook struct {
|
|||
} `json:"base"`
|
||||
|
||||
Head struct {
|
||||
SHA string `json:"sha"`
|
||||
Ref string `json:"ref"`
|
||||
SHA string `json:"sha"`
|
||||
Ref string `json:"ref"`
|
||||
Repo struct {
|
||||
CloneURL string `json:"clone_url"`
|
||||
} `json:"repo"`
|
||||
} `json:"head"`
|
||||
} `json:"pull_request"`
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue