1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-13 14:07:20 +00:00

Fix incompleted commit status events

This commit is contained in:
Lunny Xiao
2024-12-17 18:58:23 -08:00
parent 2d7e6e9482
commit a9080fabe4
18 changed files with 110 additions and 9 deletions

View File

@ -28,6 +28,7 @@ type payloadConvertor[T any] interface {
Release(*api.ReleasePayload) (T, error)
Wiki(*api.WikiPayload) (T, error)
Package(*api.PackagePayload) (T, error)
CommitStatus(*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.CommitStatus, data)
}
return t, fmt.Errorf("newPayload unsupported event: %s", event)
}