[ACTIONS] on.schedule: create a new payload

do not reuse the payload of the event that triggered the creation of
the scheduled event. Create a new one instead that contains no other
information than the event name in the action field ("schedule").

(cherry picked from commit 0b40ca1ea5e6b704bcb6c0d370a21f633facc7d6)
This commit is contained in:
Earl Warren 2023-12-23 12:17:20 +01:00
parent 892a8e1f4a
commit c6940a6c5a
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
2 changed files with 15 additions and 1 deletions

View file

@ -402,6 +402,16 @@ func (p *PullRequestPayload) JSONPayload() ([]byte, error) {
return json.MarshalIndent(p, "", " ")
}
type HookScheduleAction string
const (
HookScheduleCreated HookScheduleAction = "schedule"
)
type SchedulePayload struct {
Action HookScheduleAction `json:"action"`
}
// ReviewPayload FIXME
type ReviewPayload struct {
Type string `json:"type"`

View file

@ -397,7 +397,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)
}