mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-24 09:20:31 +00:00
bitbucket refspec and remote url
This commit is contained in:
parent
2465728633
commit
fbc6eadd32
2 changed files with 12 additions and 4 deletions
|
@ -149,10 +149,14 @@ func convertTeam(from *internal.Account) *model.Team {
|
||||||
// hook to the Drone build struct holding commit information.
|
// hook to the Drone build struct holding commit information.
|
||||||
func convertPullHook(from *internal.PullRequestHook) *model.Build {
|
func convertPullHook(from *internal.PullRequestHook) *model.Build {
|
||||||
return &model.Build{
|
return &model.Build{
|
||||||
Event: model.EventPull,
|
Event: model.EventPull,
|
||||||
Commit: from.PullRequest.Dest.Commit.Hash,
|
Commit: from.PullRequest.Dest.Commit.Hash,
|
||||||
Ref: fmt.Sprintf("refs/heads/%s", from.PullRequest.Dest.Branch.Name),
|
Ref: fmt.Sprintf("refs/heads/%s", from.PullRequest.Dest.Branch.Name),
|
||||||
Remote: cloneLink(&from.PullRequest.Dest.Repo),
|
Refspec: fmt.Sprintf("%s:%s",
|
||||||
|
from.PullRequest.Source.Branch.Name,
|
||||||
|
from.PullRequest.Dest.Branch.Name,
|
||||||
|
),
|
||||||
|
Remote: fmt.Sprintf("https://bitbucket.org/%s", from.PullRequest.Source.Repo.FullName),
|
||||||
Link: from.PullRequest.Links.Html.Href,
|
Link: from.PullRequest.Links.Html.Href,
|
||||||
Branch: from.PullRequest.Dest.Branch.Name,
|
Branch: from.PullRequest.Dest.Branch.Name,
|
||||||
Message: from.PullRequest.Desc,
|
Message: from.PullRequest.Desc,
|
||||||
|
|
|
@ -139,6 +139,8 @@ func Test_helper(t *testing.T) {
|
||||||
hook.PullRequest.Dest.Commit.Hash = "73f9c44d"
|
hook.PullRequest.Dest.Commit.Hash = "73f9c44d"
|
||||||
hook.PullRequest.Dest.Branch.Name = "master"
|
hook.PullRequest.Dest.Branch.Name = "master"
|
||||||
hook.PullRequest.Dest.Repo.Links.Html.Href = "https://bitbucket.org/foo/bar"
|
hook.PullRequest.Dest.Repo.Links.Html.Href = "https://bitbucket.org/foo/bar"
|
||||||
|
hook.PullRequest.Source.Branch.Name = "change"
|
||||||
|
hook.PullRequest.Source.Repo.FullName = "baz/bar"
|
||||||
hook.PullRequest.Links.Html.Href = "https://bitbucket.org/foo/bar/pulls/5"
|
hook.PullRequest.Links.Html.Href = "https://bitbucket.org/foo/bar/pulls/5"
|
||||||
hook.PullRequest.Desc = "updated README"
|
hook.PullRequest.Desc = "updated README"
|
||||||
hook.PullRequest.Updated = time.Now()
|
hook.PullRequest.Updated = time.Now()
|
||||||
|
@ -151,6 +153,8 @@ func Test_helper(t *testing.T) {
|
||||||
g.Assert(build.Branch).Equal(hook.PullRequest.Dest.Branch.Name)
|
g.Assert(build.Branch).Equal(hook.PullRequest.Dest.Branch.Name)
|
||||||
g.Assert(build.Link).Equal(hook.PullRequest.Links.Html.Href)
|
g.Assert(build.Link).Equal(hook.PullRequest.Links.Html.Href)
|
||||||
g.Assert(build.Ref).Equal("refs/heads/master")
|
g.Assert(build.Ref).Equal("refs/heads/master")
|
||||||
|
g.Assert(build.Refspec).Equal("change:master")
|
||||||
|
g.Assert(build.Remote).Equal("https://bitbucket.org/baz/bar")
|
||||||
g.Assert(build.Message).Equal(hook.PullRequest.Desc)
|
g.Assert(build.Message).Equal(hook.PullRequest.Desc)
|
||||||
g.Assert(build.Timestamp).Equal(hook.PullRequest.Updated.Unix())
|
g.Assert(build.Timestamp).Equal(hook.PullRequest.Updated.Unix())
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue