@@ -13,7 +13,7 @@ pub enum BuildTriggerType {
1313 Retry ,
1414 Webhook ,
1515 Schedule ,
16- ContentEdit ,
16+ WebEdit ,
1717}
1818
1919impl fmt:: Display for BuildTriggerType {
@@ -24,7 +24,7 @@ impl fmt::Display for BuildTriggerType {
2424 BuildTriggerType :: Retry => "retry" ,
2525 BuildTriggerType :: Webhook => "webhook" ,
2626 BuildTriggerType :: Schedule => "schedule" ,
27- BuildTriggerType :: ContentEdit => "content_edit " ,
27+ BuildTriggerType :: WebEdit => "webedit " ,
2828 } ;
2929 write ! ( f, "{}" , s)
3030 }
@@ -147,6 +147,19 @@ pub struct SchedulePayload {
147147 pub cl_id : Option < i64 > ,
148148}
149149
150+ #[ derive( Debug , Clone , Serialize , Deserialize ) ]
151+ pub struct WebEditPayload {
152+ pub repo : String ,
153+ pub from_hash : String ,
154+ pub commit_hash : String ,
155+ pub cl_link : String ,
156+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
157+ pub cl_id : Option < i64 > ,
158+ pub builds : serde_json:: Value ,
159+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
160+ pub triggered_by : Option < String > ,
161+ }
162+
150163/// Trigger payload - stores context specific to each trigger type
151164/// This enum is serialized to JSON and stored in database's trigger_payload column
152165#[ derive( Debug , Clone , Serialize , Deserialize ) ]
@@ -157,6 +170,7 @@ pub enum BuildTriggerPayload {
157170 Retry ( RetryPayload ) ,
158171 Webhook ( WebhookPayload ) ,
159172 Schedule ( SchedulePayload ) ,
173+ WebEdit ( WebEditPayload ) ,
160174}
161175
162176impl BuildTriggerPayload {
@@ -167,6 +181,7 @@ impl BuildTriggerPayload {
167181 BuildTriggerPayload :: Retry ( p) => & p. repo ,
168182 BuildTriggerPayload :: Webhook ( p) => & p. repo ,
169183 BuildTriggerPayload :: Schedule ( p) => & p. repo ,
184+ BuildTriggerPayload :: WebEdit ( p) => & p. repo ,
170185 }
171186 }
172187
@@ -177,6 +192,7 @@ impl BuildTriggerPayload {
177192 BuildTriggerPayload :: Retry ( p) => & p. commit_hash ,
178193 BuildTriggerPayload :: Webhook ( p) => & p. commit_hash ,
179194 BuildTriggerPayload :: Schedule ( p) => & p. commit_hash ,
195+ BuildTriggerPayload :: WebEdit ( p) => & p. commit_hash ,
180196 }
181197 }
182198
@@ -187,6 +203,7 @@ impl BuildTriggerPayload {
187203 BuildTriggerPayload :: Retry ( p) => & p. cl_link ,
188204 BuildTriggerPayload :: Webhook ( p) => & p. cl_link ,
189205 BuildTriggerPayload :: Schedule ( p) => & p. cl_link ,
206+ BuildTriggerPayload :: WebEdit ( p) => & p. cl_link ,
190207 }
191208 }
192209
@@ -197,6 +214,7 @@ impl BuildTriggerPayload {
197214 BuildTriggerPayload :: Retry ( p) => p. cl_id ,
198215 BuildTriggerPayload :: Webhook ( p) => p. cl_id ,
199216 BuildTriggerPayload :: Schedule ( p) => p. cl_id ,
217+ BuildTriggerPayload :: WebEdit ( p) => p. cl_id ,
200218 }
201219 }
202220
@@ -207,6 +225,7 @@ impl BuildTriggerPayload {
207225 BuildTriggerPayload :: Retry ( p) => Some ( & p. triggered_by ) ,
208226 BuildTriggerPayload :: Webhook ( _) => None ,
209227 BuildTriggerPayload :: Schedule ( _) => None ,
228+ BuildTriggerPayload :: WebEdit ( p) => p. triggered_by . as_deref ( ) ,
210229 }
211230 }
212231
@@ -217,6 +236,7 @@ impl BuildTriggerPayload {
217236 BuildTriggerPayload :: Retry ( p) => & p. from_hash ,
218237 BuildTriggerPayload :: Webhook ( _) => "" ,
219238 BuildTriggerPayload :: Schedule ( _) => "" ,
239+ BuildTriggerPayload :: WebEdit ( p) => & p. from_hash ,
220240 }
221241 }
222242}
@@ -358,7 +378,7 @@ impl TriggerContext {
358378impl From < mega_cl:: Model > for TriggerContext {
359379 fn from ( cl : mega_cl:: Model ) -> Self {
360380 TriggerContext {
361- trigger_type : BuildTriggerType :: ContentEdit ,
381+ trigger_type : BuildTriggerType :: WebEdit ,
362382 trigger_source : TriggerSource :: User ,
363383 triggered_by : Some ( cl. username ) ,
364384 repo_path : cl. path ,
0 commit comments