@@ -367,7 +367,6 @@ fn apply_approval_label_promotion(
367367
368368/// Check whether a content item carries the configured built-in promotion label
369369/// (case-insensitive). Returns `false` when `promotion_label` is empty (feature disabled).
370- #[ cfg( test) ]
371370pub fn has_promotion_label ( item : & Value , ctx : & PolicyContext ) -> bool {
372371 if ctx. promotion_label . is_empty ( ) {
373372 return false ;
@@ -380,7 +379,6 @@ pub fn has_promotion_label(item: &Value, ctx: &PolicyContext) -> bool {
380379
381380/// Check whether a content item carries the configured built-in demotion label
382381/// (case-insensitive). Returns `false` when `demotion_label` is empty (feature disabled).
383- #[ cfg( test) ]
384382pub fn has_demotion_label ( item : & Value , ctx : & PolicyContext ) -> bool {
385383 if ctx. demotion_label . is_empty ( ) {
386384 return false ;
@@ -400,14 +398,7 @@ fn apply_promotion_label_promotion(
400398 integrity : Vec < String > ,
401399 ctx : & PolicyContext ,
402400) -> Vec < String > {
403- if ctx. promotion_label . is_empty ( ) {
404- return integrity;
405- }
406- let label_names = extract_github_label_names ( item) ;
407- if label_names
408- . iter ( )
409- . any ( |name| ctx. promotion_label . eq_ignore_ascii_case ( name) )
410- {
401+ if has_promotion_label ( item, ctx) {
411402 let number = item. get ( field_names:: NUMBER ) . and_then ( |v| v. as_u64 ( ) ) . unwrap_or ( 0 ) ;
412403 crate :: log_info ( & format ! (
413404 "[integrity] {}:{}#{} promoted to approved (built-in promotion-label '{}')" ,
@@ -429,14 +420,7 @@ fn apply_demotion_label_demotion(
429420 integrity : Vec < String > ,
430421 ctx : & PolicyContext ,
431422) -> Vec < String > {
432- if ctx. demotion_label . is_empty ( ) {
433- return integrity;
434- }
435- let label_names = extract_github_label_names ( item) ;
436- if label_names
437- . iter ( )
438- . any ( |name| ctx. demotion_label . eq_ignore_ascii_case ( name) )
439- {
423+ if has_demotion_label ( item, ctx) {
440424 let number = item. get ( field_names:: NUMBER ) . and_then ( |v| v. as_u64 ( ) ) . unwrap_or ( 0 ) ;
441425 crate :: log_info ( & format ! (
442426 "[integrity] {}:{}#{} demoted to none (built-in demotion-label '{}')" ,
0 commit comments