@@ -13,7 +13,6 @@ import (
1313 "github.com/diggerhq/digger/libs/backendapi"
1414 "github.com/diggerhq/digger/libs/ci"
1515 comment_updater "github.com/diggerhq/digger/libs/comment_utils/summary"
16- coreutils "github.com/diggerhq/digger/libs/comment_utils/utils"
1716 "github.com/diggerhq/digger/libs/execution"
1817 locking2 "github.com/diggerhq/digger/libs/locking"
1918 "github.com/diggerhq/digger/libs/policy"
@@ -170,12 +169,12 @@ func RunJobs(jobs []orchestrator.Job, prService ci.PullRequestService, orgServic
170169func reportPolicyError (projectName string , command string , requestedBy string , reporter reporting.Reporter ) string {
171170 msg := fmt .Sprintf ("User %s is not allowed to perform action: %s. Check your policies :x:" , requestedBy , command )
172171 if reporter .SupportsMarkdown () {
173- _ , _ , err := reporter .Report (msg , coreutils .AsCollapsibleComment (fmt .Sprintf ("Policy violation for <b>%v - %v</b>" , projectName , command ), false ))
172+ _ , _ , err := reporter .Report (msg , reporting .AsCollapsibleComment (fmt .Sprintf ("Policy violation for <b>%v - %v</b>" , projectName , command ), false ))
174173 if err != nil {
175174 slog .Error ("Error publishing comment" , "error" , err )
176175 }
177176 } else {
178- _ , _ , err := reporter .Report (msg , coreutils .AsComment (fmt .Sprintf ("Policy violation for %v - %v" , projectName , command )))
177+ _ , _ , err := reporter .Report (msg , reporting .AsComment (fmt .Sprintf ("Policy violation for %v - %v" , projectName , command )))
179178 if err != nil {
180179 slog .Error ("Error publishing comment" , "error" , err )
181180 }
@@ -295,9 +294,9 @@ func run(command string, job orchestrator.Job, policyChecker policy.Checker, org
295294 var planPolicyFormatter func (report string ) string
296295 summary := fmt .Sprintf ("Terraform plan validation check (%v)" , job .ProjectName )
297296 if reporter .SupportsMarkdown () {
298- planPolicyFormatter = coreutils .AsCollapsibleComment (summary , false )
297+ planPolicyFormatter = reporting .AsCollapsibleComment (summary , false )
299298 } else {
300- planPolicyFormatter = coreutils .AsComment (summary )
299+ planPolicyFormatter = reporting .AsComment (summary )
301300 }
302301
303302 planSummary , err := iacUtils .GetSummarizePlan (planJsonOutput )
@@ -326,6 +325,10 @@ func run(command string, job orchestrator.Job, policyChecker policy.Checker, org
326325 slog .Error ("Failed to report plan." , "error" , err )
327326 }
328327 reportPlanSummary (reporter , planSummary )
328+
329+ if err := reporting .FormatAndReportExampleCommands (job .ProjectName , reporter ); err != nil {
330+ slog .Error ("Failed to report example commands." , "error" , err )
331+ }
329332 }
330333 } else {
331334 reportEmptyPlanOutput (reporter , projectLock .LockId ())
@@ -497,12 +500,12 @@ func reportApplyMergeabilityError(reporter reporting.Reporter) string {
497500 slog .Error (comment )
498501
499502 if reporter .SupportsMarkdown () {
500- _ , _ , err := reporter .Report (comment , coreutils .AsCollapsibleComment ("Apply error" , false ))
503+ _ , _ , err := reporter .Report (comment , reporting .AsCollapsibleComment ("Apply error" , false ))
501504 if err != nil {
502505 slog .Error ("error publishing comment" , "error" , err )
503506 }
504507 } else {
505- _ , _ , err := reporter .Report (comment , coreutils .AsComment ("Apply error" ))
508+ _ , _ , err := reporter .Report (comment , reporting .AsComment ("Apply error" ))
506509 if err != nil {
507510 slog .Error ("error publishing comment" , "error" , err )
508511 }
@@ -514,9 +517,9 @@ func reportTerraformPlanOutput(reporter reporting.Reporter, projectId string, pl
514517 var formatter func (string ) string
515518
516519 if reporter .SupportsMarkdown () {
517- formatter = coreutils .GetTerraformOutputAsCollapsibleComment ("Plan output" , true )
520+ formatter = reporting .GetTerraformOutputAsCollapsibleComment ("Plan output" , true )
518521 } else {
519- formatter = coreutils .GetTerraformOutputAsComment ("Plan output" )
522+ formatter = reporting .GetTerraformOutputAsComment ("Plan output" )
520523 }
521524
522525 _ , _ , err := reporter .Report (plan , formatter )
@@ -529,9 +532,9 @@ func reportPlanSummary(reporter reporting.Reporter, summary string) {
529532 var formatter func (string ) string
530533
531534 if reporter .SupportsMarkdown () {
532- formatter = coreutils .AsCollapsibleComment ("Plan summary" , false )
535+ formatter = reporting .AsCollapsibleComment ("Plan summary" , false )
533536 } else {
534- formatter = coreutils .AsComment ("Plan summary" )
537+ formatter = reporting .AsComment ("Plan summary" )
535538 }
536539
537540 _ , _ , err := reporter .Report ("\n " + summary , formatter )
0 commit comments