@@ -12,15 +12,13 @@ use regex::Regex;
12
12
use crate :: {
13
13
gh:: {
14
14
issue_id:: IssueId ,
15
- issues:: { list_issue_titles_in_milestone, ExistingGithubIssue } ,
15
+ issues:: { list_issue_titles_in_milestone, lock_issue } ,
16
16
labels:: { list_labels, GhLabel } ,
17
17
} ,
18
18
goal:: { self , GoalDocument , ParsedOwners , PlanItem , Status } ,
19
19
team:: { get_person_data, TeamName } ,
20
20
} ;
21
21
22
- const LOCK_TEXT : & str = "This issue is intended for status updates only.\n \n For general questions or comments, please contact the owner(s) directly." ;
23
-
24
22
fn validate_path ( path : & Path ) -> anyhow:: Result < String > {
25
23
if !path. is_dir ( ) {
26
24
return Err ( anyhow:: anyhow!(
@@ -559,56 +557,7 @@ impl GithubAction<'_> {
559
557
}
560
558
}
561
559
562
- fn lock_issue ( repository : & str , number : u64 ) -> anyhow:: Result < ( ) > {
563
- let output = Command :: new ( "gh" )
564
- . arg ( "-R" )
565
- . arg ( repository)
566
- . arg ( "issue" )
567
- . arg ( "lock" )
568
- . arg ( number. to_string ( ) )
569
- . output ( ) ?;
570
-
571
- if !output. status . success ( ) {
572
- if !output. stderr . starts_with ( b"already locked" ) {
573
- return Err ( anyhow:: anyhow!(
574
- "failed to lock issue `{}`: {}" ,
575
- number,
576
- String :: from_utf8_lossy( & output. stderr)
577
- ) ) ;
578
- }
579
- }
580
-
581
- // Leave a comment explaining what is going on.
582
- let output = Command :: new ( "gh" )
583
- . arg ( "-R" )
584
- . arg ( repository)
585
- . arg ( "issue" )
586
- . arg ( "comment" )
587
- . arg ( number. to_string ( ) )
588
- . arg ( "-b" )
589
- . arg ( LOCK_TEXT )
590
- . output ( ) ?;
591
-
592
- if !output. status . success ( ) {
593
- return Err ( anyhow:: anyhow!(
594
- "failed to leave lock comment `{}`: {}" ,
595
- number,
596
- String :: from_utf8_lossy( & output. stderr)
597
- ) ) ;
598
- }
599
-
600
- Ok ( ( ) )
601
- }
602
-
603
560
/// Returns a comma-separated list of the strings in `s` (no spaces).
604
561
fn comma ( s : & BTreeSet < String > ) -> String {
605
562
s. iter ( ) . map ( |s| & s[ ..] ) . collect :: < Vec < _ > > ( ) . join ( "," )
606
563
}
607
-
608
- impl ExistingGithubIssue {
609
- /// We use the presence of a "lock comment" as a signal that we successfully locked the issue.
610
- /// The github CLI doesn't let you query that directly.
611
- fn was_locked ( & self ) -> bool {
612
- self . comments . iter ( ) . any ( |c| c. body . trim ( ) == LOCK_TEXT )
613
- }
614
- }
0 commit comments