This commit is contained in:
Adam Majer 2024-08-26 14:09:23 +02:00
parent ff877cc987
commit 0473ef7c37
2 changed files with 27 additions and 1 deletions

View File

@ -0,0 +1,10 @@
package common
type WikiWebhookEvent struct {
Action string
Page string
Comment string
Repository Repository
Sender User
}

View File

@ -275,8 +275,24 @@ func parseRequestJSON(reqType string, data []byte) (org *common.Organization, ex
org = pr.Repository.Owner
extraAction = ""
case "wiki":
wiki := common.WikiWebhookEvent{}
if err = json.Unmarshal(data, &wiki); err != nil {
return
}
switch wiki.Action {
case "created", "edited", "renamed", "deleted":
break
default:
err = fmt.Errorf("Unknown Wiki webhook action type: %s", wiki.Action)
return
}
org = wiki.Repository.Owner
extraAction = wiki.Action
default:
// TODO: package and wiki
// TODO: package webhook
err = fmt.Errorf("Unknown webhook request type: %s", reqType)
}