Add [cast_to_bool] and factorise "if" rules.

1 job for ci/cast_to_bool in 17 minutes and 51 seconds (queued for 6 seconds)