mirror of
				https://codeberg.org/forgejo/forgejo.git
				synced 2025-10-31 22:41:03 +00:00 
			
		
		
		
	[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 0b40ca1ea5)
(cherry picked from commit f86487432b)
(cherry picked from commit 4bd5d2e9d0)
(cherry picked from commit d10830e238)
(cherry picked from commit 53f5a3aa91)
	
	
This commit is contained in:
		
					parent
					
						
							
								d31ce2f03d
							
						
					
				
			
			
				commit
				
					
						9ed1487b73
					
				
			
		
					 2 changed files with 15 additions and 1 deletions
				
			
		|  | @ -402,6 +402,16 @@ func (p *PullRequestPayload) JSONPayload() ([]byte, error) { | ||||||
| 	return json.MarshalIndent(p, "", "  ") | 	return json.MarshalIndent(p, "", "  ") | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | type HookScheduleAction string | ||||||
|  | 
 | ||||||
|  | const ( | ||||||
|  | 	HookScheduleCreated HookScheduleAction = "schedule" | ||||||
|  | ) | ||||||
|  | 
 | ||||||
|  | type SchedulePayload struct { | ||||||
|  | 	Action HookScheduleAction `json:"action"` | ||||||
|  | } | ||||||
|  | 
 | ||||||
| // ReviewPayload FIXME | // ReviewPayload FIXME | ||||||
| type ReviewPayload struct { | type ReviewPayload struct { | ||||||
| 	Type    string `json:"type"` | 	Type    string `json:"type"` | ||||||
|  |  | ||||||
|  | @ -436,7 +436,11 @@ func handleSchedules( | ||||||
| 		return nil | 		return nil | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	p, err := json.Marshal(input.Payload) | 	payload := &api.SchedulePayload{ | ||||||
|  | 		Action: api.HookScheduleCreated, | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	p, err := json.Marshal(payload) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return fmt.Errorf("json.Marshal: %w", err) | 		return fmt.Errorf("json.Marshal: %w", err) | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue