From 012ae8f1612f68d9b36a9c91c2d0b40705bdfe22 Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Thu, 21 Dec 2023 23:45:50 +0100 Subject: [PATCH] [GITEA] add proper payload to scheduled events --- modules/structs/hook.go | 10 ++++++++++ services/actions/notifier_helper.go | 6 +++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/modules/structs/hook.go b/modules/structs/hook.go index 0babe84410..12dac78f91 100644 --- a/modules/structs/hook.go +++ b/modules/structs/hook.go @@ -402,6 +402,16 @@ func (p *PullRequestPayload) JSONPayload() ([]byte, error) { return json.MarshalIndent(p, "", " ") } +type HookScheduleAction string + +const ( + HookScheduleCreated HookScheduleAction = "created" +) + +type SchedulePayload struct { + Action HookScheduleAction `json:"action"` +} + // ReviewPayload FIXME type ReviewPayload struct { Type string `json:"type"` diff --git a/services/actions/notifier_helper.go b/services/actions/notifier_helper.go index 175b8a4118..6900131a41 100644 --- a/services/actions/notifier_helper.go +++ b/services/actions/notifier_helper.go @@ -423,7 +423,11 @@ func handleSchedules( return nil } - p, err := json.Marshal(input.Payload) + payload := &api.SchedulePayload{ + Action: api.HookScheduleCreated, + } + + p, err := json.Marshal(payload) if err != nil { return fmt.Errorf("json.Marshal: %w", err) }