@@ -13,7 +13,7 @@ use rust_project_goals::{
1313 gh:: {
1414 issue_id:: { IssueId , Repository } ,
1515 issues:: {
16- change_milestone, create_comment, create_issue, fetch_issue, list_issues_in_milestone, lock_issue, sync_assignees, FLAGSHIP_LABEL , LOCK_TEXT
16+ change_milestone, create_comment, create_issue, fetch_issue, list_issues_in_milestone, lock_issue, sync_assignees, update_issue_body , FLAGSHIP_LABEL , LOCK_TEXT
1717 } ,
1818 labels:: GhLabel ,
1919 } ,
@@ -209,6 +209,11 @@ enum GithubAction<'doc> {
209209 body : String ,
210210 } ,
211211
212+ UpdateIssueBody {
213+ number : u64 ,
214+ body : String ,
215+ } ,
216+
212217 // We intentionally do not sync the issue *text*, because it may have been edited.
213218 SyncAssignees {
214219 number : u64 ,
@@ -348,6 +353,14 @@ fn initialize_issues<'doc>(
348353 } ) ;
349354 }
350355
356+ let link_text = goal_document_link ( timeframe, & desired_issue. goal_document ) ;
357+ if !existing_issue. body . contains ( & link_text) {
358+ actions. insert ( GithubAction :: UpdateIssueBody {
359+ number : existing_issue. number ,
360+ body : existing_issue. body ,
361+ } ) ;
362+ }
363+
351364 let issue_id = IssueId :: new ( repository. clone ( ) , existing_issue. number ) ;
352365 if desired_issue. tracking_issue != Some ( & issue_id) {
353366 actions. insert ( GithubAction :: LinkToTrackingIssue {
@@ -394,6 +407,11 @@ fn issue<'doc>(timeframe: &str, document: &'doc GoalDocument) -> anyhow::Result<
394407 } )
395408}
396409
410+ fn goal_document_link ( timeframe : & str , document : & GoalDocument ) -> String {
411+ let goal_file = document. link_path . file_stem ( ) . unwrap ( ) . to_str ( ) . unwrap ( ) ;
412+ format ! ( "[{timeframe}/{goal_file}](https://rust-lang.github.io/rust-project-goals/{timeframe}/{goal_file}.html)" )
413+ }
414+
397415fn issue_text ( timeframe : & str , document : & GoalDocument ) -> anyhow:: Result < String > {
398416 let mut tasks = vec ! [ ] ;
399417 for goal_plan in & document. goal_plans {
@@ -406,15 +424,13 @@ fn issue_text(timeframe: &str, document: &GoalDocument) -> anyhow::Result<String
406424 . map ( |team| team. name_and_link ( ) )
407425 . collect :: < Vec < _ > > ( ) ;
408426
409- let goal_file = document. link_path . file_stem ( ) . unwrap ( ) . to_str ( ) . unwrap ( ) ;
410-
411427 Ok ( format ! (
412428 r##"
413429| Metadata | |
414430| -------- | --- |
415431| Point of contact | {poc} |
416432| Team(s) | {teams} |
417- | Goal document | [{timeframe}/{goal_file}](https://rust-lang.github.io/rust-project-goals/{timeframe}/{goal_file}.html) |
433+ | Goal document | {goaldocument} |
418434
419435## Summary
420436
@@ -430,6 +446,7 @@ fn issue_text(timeframe: &str, document: &GoalDocument) -> anyhow::Result<String
430446 teams = teams. join( ", " ) ,
431447 summary = document. summary,
432448 tasks = tasks. join( "\n " ) ,
449+ goaldocument = goal_document_link( timeframe, document) ,
433450 ) )
434451}
435452
@@ -495,6 +512,9 @@ impl Display for GithubAction<'_> {
495512 GithubAction :: Comment { number, body } => {
496513 write ! ( f, "post comment on issue #{}: \" {}\" " , number, body)
497514 }
515+ GithubAction :: UpdateIssueBody { number, body : _ } => {
516+ write ! ( f, "update the body on issue #{} for new milestone" , number)
517+ }
498518 GithubAction :: SyncAssignees {
499519 number,
500520 remove_owners,
@@ -565,6 +585,11 @@ impl GithubAction<'_> {
565585 Ok ( ( ) )
566586 }
567587
588+ GithubAction :: UpdateIssueBody { number, body } => {
589+ update_issue_body ( repository, number, & body) ?;
590+ Ok ( ( ) )
591+ }
592+
568593 GithubAction :: SyncAssignees {
569594 number,
570595 remove_owners,
0 commit comments