@@ -449,7 +449,9 @@ enum SecondedLogicError {
449
449
draft : bool ,
450
450
open : bool ,
451
451
} ,
452
- ConcernsLabelSet ,
452
+ NotAMajorChange ,
453
+ SecondLabelAbsent ,
454
+ ConcernsLabelPresent ,
453
455
NoMajorChangeConfig ,
454
456
}
455
457
@@ -464,7 +466,9 @@ impl Display for SecondedLogicError {
464
466
SecondedLogicError :: IssueNotReady { draft, open } => {
465
467
write ! ( f, "issue is not ready (draft: {draft}; open: {open})" )
466
468
}
467
- SecondedLogicError :: ConcernsLabelSet => write ! ( f, "concerns label set" ) ,
469
+ SecondedLogicError :: NotAMajorChange => write ! ( f, "not a major change" ) ,
470
+ SecondedLogicError :: SecondLabelAbsent => write ! ( f, "second label is absent" ) ,
471
+ SecondedLogicError :: ConcernsLabelPresent => write ! ( f, "concerns label set" ) ,
468
472
SecondedLogicError :: NoMajorChangeConfig => write ! ( f, "no `[major_change]` config" ) ,
469
473
}
470
474
}
@@ -557,12 +561,17 @@ async fn process_seconded(
557
561
. await
558
562
. context ( "unable to get the associated issue" ) ?;
559
563
560
- if issue
561
- . labels
562
- . iter ( )
563
- . any ( |l| Some ( & l. name ) == config. concerns_label . as_ref ( ) )
564
- {
565
- anyhow:: bail!( SecondedLogicError :: ConcernsLabelSet ) ;
564
+ if !issue. labels . iter ( ) . any ( |l| l. name == config. enabling_label ) {
565
+ anyhow:: bail!( SecondedLogicError :: NotAMajorChange ) ;
566
+ }
567
+
568
+ if !issue. labels . iter ( ) . any ( |l| l. name == config. second_label ) {
569
+ anyhow:: bail!( SecondedLogicError :: SecondLabelAbsent ) ;
570
+ }
571
+
572
+ let concerns_label = config. concerns_label . as_ref ( ) ;
573
+ if issue. labels . iter ( ) . any ( |l| Some ( & l. name ) == concerns_label) {
574
+ anyhow:: bail!( SecondedLogicError :: ConcernsLabelPresent ) ;
566
575
}
567
576
568
577
if !issue. is_open ( ) || issue. draft {
0 commit comments