mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-27 04:11:03 +00:00
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,
|
Author: from.PullRequest.User.Login,
|
||||||
Avatar: from.PullRequest.User.Avatar,
|
Avatar: from.PullRequest.User.Avatar,
|
||||||
Title: from.PullRequest.Title,
|
Title: from.PullRequest.Title,
|
||||||
|
Remote: from.PullRequest.Head.Repo.CloneURL,
|
||||||
Refspec: fmt.Sprintf(refspec,
|
Refspec: fmt.Sprintf(refspec,
|
||||||
from.PullRequest.Head.Ref,
|
from.PullRequest.Head.Ref,
|
||||||
from.PullRequest.Base.Ref,
|
from.PullRequest.Base.Ref,
|
||||||
|
|
|
@ -175,6 +175,7 @@ func Test_helper(t *testing.T) {
|
||||||
from.PullRequest.Base.Ref = "master"
|
from.PullRequest.Base.Ref = "master"
|
||||||
from.PullRequest.Head.Ref = "changes"
|
from.PullRequest.Head.Ref = "changes"
|
||||||
from.PullRequest.Head.SHA = "f72fc19"
|
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.HTMLURL = "https://github.com/octocat/hello-world/pulls/42"
|
||||||
from.PullRequest.Number = 42
|
from.PullRequest.Number = 42
|
||||||
from.PullRequest.Title = "Updated README.md"
|
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.Branch).Equal(from.PullRequest.Head.Ref)
|
||||||
g.Assert(build.Ref).Equal("refs/pull/42/merge")
|
g.Assert(build.Ref).Equal("refs/pull/42/merge")
|
||||||
g.Assert(build.Refspec).Equal("changes:master")
|
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.Commit).Equal(from.PullRequest.Head.SHA)
|
||||||
g.Assert(build.Message).Equal(from.PullRequest.Title)
|
g.Assert(build.Message).Equal(from.PullRequest.Title)
|
||||||
g.Assert(build.Title).Equal(from.PullRequest.Title)
|
g.Assert(build.Title).Equal(from.PullRequest.Title)
|
||||||
|
|
|
@ -73,8 +73,11 @@ type webhook struct {
|
||||||
} `json:"base"`
|
} `json:"base"`
|
||||||
|
|
||||||
Head struct {
|
Head struct {
|
||||||
SHA string `json:"sha"`
|
SHA string `json:"sha"`
|
||||||
Ref string `json:"ref"`
|
Ref string `json:"ref"`
|
||||||
|
Repo struct {
|
||||||
|
CloneURL string `json:"clone_url"`
|
||||||
|
} `json:"repo"`
|
||||||
} `json:"head"`
|
} `json:"head"`
|
||||||
} `json:"pull_request"`
|
} `json:"pull_request"`
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue