1
0
mirror of https://github.com/woodpecker-ci/woodpecker.git synced 2024-11-30 08:06:52 +02:00

track github remote url

This commit is contained in:
Brad Rydzewski 2016-11-19 22:54:05 +01:00
parent dc0fdbc221
commit 2465728633
3 changed files with 8 additions and 2 deletions

View File

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

View File

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

View File

@ -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"`
}