@@ -34,7 +34,6 @@ import (
34
34
"net/http"
35
35
"net/url"
36
36
"os"
37
- "path"
38
37
"path/filepath"
39
38
"reflect"
40
39
"runtime/debug"
@@ -511,7 +510,19 @@ func handlePullRequestEvent(gh utils.GithubClientProvider, payload *github.PullR
511
510
log .Printf ("strconv.ParseInt error: %v" , err )
512
511
commentReporterManager .UpdateComment (fmt .Sprintf (":x: could not handle commentId: %v" , err ))
513
512
}
514
- batchId , _ , err := utils .ConvertJobsToDiggerJobs (* diggerCommand , models .DiggerVCSGithub , organisationId , impactedJobsMap , impactedProjectsMap , projectsGraph , installationId , branch , prNumber , repoOwner , repoName , repoFullName , commitSha , commentId , diggerYmlStr , 0 )
513
+
514
+ var aiSummaryCommentId = ""
515
+ if config .Reporting .AiSummary {
516
+ aiSummaryComment , err := ghService .PublishComment (prNumber , "AI Summary will be posted here after completion" )
517
+ if err != nil {
518
+ log .Printf ("could not post ai summary comment: %v" , err )
519
+ commentReporterManager .UpdateComment (fmt .Sprintf (":x: could not post ai comment summary comment id: %v" , err ))
520
+ return fmt .Errorf ("could not post ai summary comment: %v" , err )
521
+ }
522
+ aiSummaryCommentId = aiSummaryComment .Id
523
+ }
524
+
525
+ batchId , _ , err := utils .ConvertJobsToDiggerJobs (* diggerCommand , models .DiggerVCSGithub , organisationId , impactedJobsMap , impactedProjectsMap , projectsGraph , installationId , branch , prNumber , repoOwner , repoName , repoFullName , commitSha , commentId , diggerYmlStr , 0 , aiSummaryCommentId , config .ReportTerraformOutputs )
515
526
if err != nil {
516
527
log .Printf ("ConvertJobsToDiggerJobs error: %v" , err )
517
528
commentReporterManager .UpdateComment (fmt .Sprintf (":x: ConvertJobsToDiggerJobs error: %v" , err ))
@@ -585,8 +596,11 @@ func GetDiggerConfigForBranch(gh utils.GithubClientProvider, installationId int6
585
596
var dependencyGraph graph.Graph [string , dg_configuration.Project ]
586
597
587
598
err = utils .CloneGitRepoAndDoAction (cloneUrl , branch , "" , * token , func (dir string ) error {
588
- diggerYmlBytes , err := os .ReadFile (path .Join (dir , "digger.yml" ))
589
- diggerYmlStr = string (diggerYmlBytes )
599
+ diggerYmlStr , err = dg_configuration .ReadDiggerYmlFileContents (dir )
600
+ if err != nil {
601
+ log .Printf ("could not load digger config: %v" , err )
602
+ return err
603
+ }
590
604
config , _ , dependencyGraph , err = dg_configuration .LoadDiggerConfig (dir , true , changedFiles )
591
605
if err != nil {
592
606
log .Printf ("Error loading digger config: %v" , err )
@@ -768,7 +782,10 @@ func handleIssueCommentEvent(gh utils.GithubClientProvider, payload *github.Issu
768
782
// terraform code generator
769
783
if os .Getenv ("DIGGER_GENERATION_ENABLED" ) == "1" {
770
784
err = GenerateTerraformFromCode (payload , commentReporterManager , config , defaultBranch , ghService , repoOwner , repoName , commitSha , issueNumber , branch )
771
- return err
785
+ if err != nil {
786
+ log .Printf ("terraform generation failed: %v" , err )
787
+ return err
788
+ }
772
789
}
773
790
774
791
commentIdStr := strconv .FormatInt (userCommentId , 10 )
@@ -902,7 +919,18 @@ func handleIssueCommentEvent(gh utils.GithubClientProvider, payload *github.Issu
902
919
return fmt .Errorf ("comment reporter error: %v" , err )
903
920
}
904
921
905
- batchId , _ , err := utils .ConvertJobsToDiggerJobs (* diggerCommand , "github" , orgId , impactedProjectsJobMap , impactedProjectsMap , projectsGraph , installationId , * branch , issueNumber , repoOwner , repoName , repoFullName , * commitSha , reporterCommentId , diggerYmlStr , 0 )
922
+ var aiSummaryCommentId = ""
923
+ if config .Reporting .AiSummary {
924
+ aiSummaryComment , err := ghService .PublishComment (issueNumber , "AI Summary will be posted here after completion" )
925
+ if err != nil {
926
+ log .Printf ("could not post ai summary comment: %v" , err )
927
+ commentReporterManager .UpdateComment (fmt .Sprintf (":x: could not post ai comment summary comment id: %v" , err ))
928
+ return fmt .Errorf ("could not post ai summary comment: %v" , err )
929
+ }
930
+ aiSummaryCommentId = aiSummaryComment .Id
931
+ }
932
+
933
+ batchId , _ , err := utils .ConvertJobsToDiggerJobs (* diggerCommand , "github" , orgId , impactedProjectsJobMap , impactedProjectsMap , projectsGraph , installationId , * branch , issueNumber , repoOwner , repoName , repoFullName , * commitSha , reporterCommentId , diggerYmlStr , 0 , aiSummaryCommentId , config .ReportTerraformOutputs )
906
934
if err != nil {
907
935
log .Printf ("ConvertJobsToDiggerJobs error: %v" , err )
908
936
commentReporterManager .UpdateComment (fmt .Sprintf (":x: ConvertJobsToDiggerJobs error: %v" , err ))
0 commit comments