I’m implementing a go workload that takes webhook events from GItea and does different things.
I’ve been digging around the SDK, Gitea code, etc.. and I’ve struggled to find a clear way to handle this. What’s the shortest path to converting a *http.Request to, I’d imagine, one of the payload types in modules/structs (unless I’m missing a more coherent, clear type somewhere)?
1 Like
To add on, the go-github package works partially, in that github.ValidatePayload won’t work (invalid payload signature from Gitea), but if you pass the request body bytes in to github.ParseWebHook, it does marshal the payload into the corresponding type and you can properly type switch to handle it. The result, however, is you only get part of the GItea event payload.
If there’s not a similar Gitea webhook client package (like the very convenient and easy to use github version) I’d be happy to start working up a PR. Being my first contribution to the Gitea project, a hint as to where the client package should live would be helpful.