+Github webhooks

This commit is contained in:
Simon Martens
2025-09-28 18:13:26 +02:00
parent 3b19ea94b6
commit 2bf6315f50
5 changed files with 27 additions and 18 deletions

View File

@@ -188,15 +188,7 @@ func (k *KGPZ) Routes(srv *fiber.App) error {
srv.Get(CITATION_URL, controllers.Get(CITATION_URL))
if k.Config.WebHookSecret != "" && k.Config.WebHookEndpoint != "" {
handler, rc := controllers.PostWebhook(k.Config.WebHookSecret)
srv.Post(k.Config.WebHookEndpoint, handler)
go func() {
for signal := range rc {
if signal {
k.Pull()
}
}
}()
srv.Post(k.Config.WebHookEndpoint, controllers.PostWebhook(k))
}
return nil
@@ -594,6 +586,10 @@ func (k *KGPZ) IsDebug() bool {
return k.Config.Debug
}
func (k *KGPZ) GetWebHookSecret() string {
return k.Config.WebHookSecret
}
func (k *KGPZ) Pull() {
if k.Repo == nil {
return