Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions server/forge/bitbucket/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func parseHook(r *http.Request) (*model.Repo, *model.Pipeline, error) {
}

// parsePushHook parses a push hook and returns the Repo and Pipeline details.
// If the commit type is unsupported nil values are returned.
// If the commit type is unsupported it returns an ErrIgnoreEvent error.
func parsePushHook(payload []byte) (*model.Repo, *model.Pipeline, error) {
hook := internal.PushHook{}

Expand All @@ -71,7 +71,7 @@ func parsePushHook(payload []byte) (*model.Repo, *model.Pipeline, error) {
}
return convertRepo(&hook.Repo, &internal.RepoPerm{}), convertPushHook(&hook, &change), nil
}
return nil, nil, nil
return nil, nil, &types.ErrIgnoreEvent{Event: "push", Reason: "BB reports no Changes"}
}

// parsePullHook parses a pull request hook and returns the Repo and Pipeline
Expand Down
2 changes: 1 addition & 1 deletion server/forge/bitbucket/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func Test_parseHook(t *testing.T) {
r, b, err := parseHook(req)
assert.Nil(t, r)
assert.Nil(t, b)
assert.NoError(t, err)
assert.ErrorIs(t, err, &types.ErrIgnoreEvent{})
})

t.Run("push hook", func(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion server/forge/bitbucketdatacenter/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (

bb "github.com/neticdk/go-bitbucket/bitbucket"

"go.woodpecker-ci.org/woodpecker/v3/server/forge/types"
"go.woodpecker-ci.org/woodpecker/v3/server/model"
)

Expand Down Expand Up @@ -35,7 +36,7 @@ func parseHook(r *http.Request, baseURL string) (*HookResult, error) {
result.Repo = convertRepo(&e.PullRequest.Target.Repository, nil, "")
result.Pipeline = convertPullRequestEvent(e, baseURL)
default:
return nil, fmt.Errorf("unsupported webhook event type: %T", e)
return nil, &types.ErrIgnoreEvent{Event: fmt.Sprintf("%T", e), Reason: "unsupported webhook event type"}
}

return result, nil
Expand Down