diff --git a/server/forge/bitbucketserver/convert.go b/server/forge/bitbucketserver/convert.go index ed8646a014..32de19e089 100644 --- a/server/forge/bitbucketserver/convert.go +++ b/server/forge/bitbucketserver/convert.go @@ -74,6 +74,9 @@ func convertRepositoryPushEvent(ev *bb.RepositoryPushEvent, baseURL string) *mod // No ToHash present - could be "DELETE" return nil } + if change.Type == bb.RepositoryPushEventChangeTypeDelete { + return nil + } pipeline := &model.Pipeline{ Commit: change.ToHash, diff --git a/server/forge/bitbucketserver/convert_test.go b/server/forge/bitbucketserver/convert_test.go index 1b0855779c..9f3f644150 100644 --- a/server/forge/bitbucketserver/convert_test.go +++ b/server/forge/bitbucketserver/convert_test.go @@ -109,6 +109,18 @@ func Test_helper(t *testing.T) { }, to: nil, }, + { + from: &bb.RepositoryPushEvent{ + Changes: []bb.RepositoryPushEventChange{ + { + FromHash: "0000000000000000000000000000000000000000", + ToHash: "1234567890abcdef", + Type: bb.RepositoryPushEventChangeTypeDelete, + }, + }, + }, + to: nil, + }, { from: &bb.RepositoryPushEvent{ Event: bb.Event{