@@ -263,6 +263,12 @@ func execTestTerraformVCR(prNumber, mmCommitSha, buildID, projectID, buildStep,
263263 if err != nil {
264264 return fmt .Errorf ("error formatting post replay comment: %w" , err )
265265 }
266+ if len (replayingResult .FailedTests ) == 0 {
267+ mentionStr := getMentions (prNumber , gh )
268+ if mentionStr != "" {
269+ comment = fmt .Sprintf ("%s\n \n %s VCR tests complete for %s!" , comment , mentionStr , mmCommitSha )
270+ }
271+ }
266272 if err := appendVCRResultToDiffComment (prNumber , comment , gh , rnr ); err != nil {
267273 return fmt .Errorf ("error appending comment: %w" , err )
268274 }
@@ -345,6 +351,10 @@ func execTestTerraformVCR(prNumber, mmCommitSha, buildID, projectID, buildStep,
345351 if err != nil {
346352 return fmt .Errorf ("error formatting record replay comment: %w" , err )
347353 }
354+ mentionStr := getMentions (prNumber , gh )
355+ if mentionStr != "" {
356+ recordReplayComment = fmt .Sprintf ("%s\n \n %s VCR tests complete for %s!" , recordReplayComment , mentionStr , mmCommitSha )
357+ }
348358 if err := appendVCRResultToDiffComment (prNumber , recordReplayComment , gh , rnr ); err != nil {
349359 return fmt .Errorf ("error appending comment: %w" , err )
350360 }
@@ -501,6 +511,10 @@ func handlePanics(prNumber, buildID, buildStatusTargetURL, mmCommitSha string, r
501511 comment := color ("red" , fmt .Sprintf ("The provider crashed while running the VCR tests in %s mode\n " , mode .Upper ()))
502512 comment += fmt .Sprintf (`Please fix it to complete your PR.
503513View the [build log](https://storage.cloud.google.com/ci-vcr-logs/beta/refs/heads/auto-pr-%s/artifacts/%s/build-log/%s_test.log)` , prNumber , buildID , mode .Lower ())
514+ mentionStr := getMentions (prNumber , gh )
515+ if mentionStr != "" {
516+ comment = fmt .Sprintf ("%s\n \n %s VCR tests complete for %s!" , comment , mentionStr , mmCommitSha )
517+ }
504518 if err := appendVCRResultToDiffComment (prNumber , comment , gh , rnr ); err != nil {
505519 return true , fmt .Errorf ("error appending comment: %v" , err )
506520 }
@@ -512,6 +526,35 @@ View the [build log](https://storage.cloud.google.com/ci-vcr-logs/beta/refs/head
512526 return false , nil
513527}
514528
529+ func getMentions (prNumber string , gh GithubClient ) string {
530+ author := ""
531+ reviewerMentions := ""
532+ if authorName , err := gh .GetPullRequestAuthor (prNumber ); err == nil {
533+ author = "@" + authorName
534+ }
535+ if reviewers , err := gh .GetPullRequestRequestedReviewers (prNumber ); err == nil {
536+ var mentions []string
537+ for _ , r := range reviewers {
538+ mentions = append (mentions , "@" + r .Login )
539+ }
540+ if len (mentions ) > 0 {
541+ reviewerMentions = strings .Join (mentions , ", " )
542+ }
543+ }
544+
545+ mentionStr := ""
546+ if author != "" {
547+ mentionStr += author
548+ }
549+ if reviewerMentions != "" {
550+ if mentionStr != "" {
551+ mentionStr += ", "
552+ }
553+ mentionStr += reviewerMentions
554+ }
555+ return mentionStr
556+ }
557+
515558// appendVCRResultToDiffComment appends content to the existing diff report comment
516559// identified by the ID in /workspace/diff_comment_id.txt.
517560// If the file is missing or the comment cannot be fetched, it falls back to posting a new comment.
0 commit comments