Skip to content

Commit

Permalink
fix: Do not trigger build on deleted refs
Browse files Browse the repository at this point in the history
  • Loading branch information
langecode committed Oct 23, 2023
1 parent 94d95fe commit fd585b2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions server/forge/bitbucketserver/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
12 changes: 12 additions & 0 deletions server/forge/bitbucketserver/convert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down

0 comments on commit fd585b2

Please sign in to comment.