@@ -828,7 +828,10 @@ async fn process_deliveries(app: &Arc<App>) -> Result<()> {
828828 }
829829 "check_run" if & payload. action == "requested_action" => {
830830 let actid = if let Some ( ra) = & payload. requested_action {
831- if ra. identifier != "auth" && ra. identifier != "cancel" {
831+ if ra. identifier != "auth"
832+ && ra. identifier != "cancel"
833+ && ra. identifier != "cancel_all"
834+ {
832835 /*
833836 * Authorisation and cancellation are the only actions
834837 * we know how to do for now.
@@ -904,23 +907,49 @@ async fn process_deliveries(app: &Arc<App>) -> Result<()> {
904907 continue ;
905908 }
906909 CheckRunVariety :: Basic => {
907- if actid != "cancel" {
908- warn ! (
909- log,
910- "delivery {} for {:?} on basic check run" ,
911- del. seq,
912- actid,
913- ) ;
914- app. db . delivery_ack ( del. seq , ack) ?;
915- continue ;
910+ match actid. as_str ( ) {
911+ "cancel" => {
912+ /*
913+ * Cancel any work that has been queued but not
914+ * yet performed:
915+ */
916+ variety:: basic:: cancel ( app, & cs, & mut cr)
917+ . await ?;
918+ }
919+ "cancel_all" => {
920+ /*
921+ * Cancel any work that has been queued but not
922+ * yet performed for all basic variety check
923+ * runs in this suite:
924+ */
925+ for mut cr in
926+ app. db . list_check_runs_for_suite ( & cs. id ) ?
927+ {
928+ if !cr. active
929+ || !matches ! (
930+ cr. variety,
931+ CheckRunVariety :: Basic
932+ )
933+ {
934+ continue ;
935+ }
936+
937+ variety:: basic:: cancel ( app, & cs, & mut cr)
938+ . await ?;
939+ }
940+ }
941+ other => {
942+ warn ! (
943+ log,
944+ "delivery {} for {:?} on basic check run" ,
945+ del. seq,
946+ other,
947+ ) ;
948+ app. db . delivery_ack ( del. seq , ack) ?;
949+ continue ;
950+ }
916951 }
917952
918- /*
919- * Cancel any work that has been queued but not yet
920- * performed:
921- */
922- variety:: basic:: cancel ( app, & cs, & mut cr) . await ?;
923-
924953 app. db . delivery_ack ( del. seq , ack) ?;
925954 continue ;
926955 }
0 commit comments