mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Fix commit status events (#33320)
Fix #32873 Fix #33201 ~Fix #33244~ ~Fix #33302~ depends on ~#33396~ A part of this PR should be backported to v1.23 manually.
This commit is contained in:
@@ -28,6 +28,7 @@ type payloadConvertor[T any] interface {
|
||||
Release(*api.ReleasePayload) (T, error)
|
||||
Wiki(*api.WikiPayload) (T, error)
|
||||
Package(*api.PackagePayload) (T, error)
|
||||
Status(*api.CommitStatusPayload) (T, error)
|
||||
}
|
||||
|
||||
func convertUnmarshalledJSON[T, P any](convert func(P) (T, error), data []byte) (t T, err error) {
|
||||
@@ -77,6 +78,8 @@ func newPayload[T any](rc payloadConvertor[T], data []byte, event webhook_module
|
||||
return convertUnmarshalledJSON(rc.Wiki, data)
|
||||
case webhook_module.HookEventPackage:
|
||||
return convertUnmarshalledJSON(rc.Package, data)
|
||||
case webhook_module.HookEventStatus:
|
||||
return convertUnmarshalledJSON(rc.Status, data)
|
||||
}
|
||||
return t, fmt.Errorf("newPayload unsupported event: %s", event)
|
||||
}
|
||||
|
Reference in New Issue
Block a user