@@ -12,15 +12,13 @@ use regex::Regex;
1212use crate :: {
1313 gh:: {
1414 issue_id:: IssueId ,
15- issues:: { list_issue_titles_in_milestone, ExistingGithubIssue } ,
15+ issues:: { list_issue_titles_in_milestone, lock_issue } ,
1616 labels:: { list_labels, GhLabel } ,
1717 } ,
1818 goal:: { self , GoalDocument , ParsedOwners , PlanItem , Status } ,
1919 team:: { get_person_data, TeamName } ,
2020} ;
2121
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-
2422fn validate_path ( path : & Path ) -> anyhow:: Result < String > {
2523 if !path. is_dir ( ) {
2624 return Err ( anyhow:: anyhow!(
@@ -559,56 +557,7 @@ impl GithubAction<'_> {
559557 }
560558}
561559
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-
603560/// Returns a comma-separated list of the strings in `s` (no spaces).
604561fn comma ( s : & BTreeSet < String > ) -> String {
605562 s. iter ( ) . map ( |s| & s[ ..] ) . collect :: < Vec < _ > > ( ) . join ( "," )
606563}
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