Notify hourly generated reports after success

This commit is contained in:
2026-06-14 05:13:40 +00:00
parent 9e14a9b7c7
commit f6e20d1412
5 changed files with 188 additions and 15 deletions

View File

@@ -720,6 +720,27 @@ func generateTextTemplateReport(ctx context.Context, req generatedReportRequest)
if err != nil {
return nil, err
}
outputPath := reportPath
if req.OutputPath != "" {
outputPath = req.OutputPath
if req.OutputPath != reportPath {
if err := fileutil.CopyFileAtomic(reportPath, req.OutputPath); err != nil {
return nil, err
}
}
}
notification, notificationPath, notificationErr := notifyReport(ctx, req.Config, req.Resolved, reportPath, req.metadata, req.Notifier, req.store)
if notificationPath != "" {
req.metadata.NotificationPath = notificationPath
metadataPath, err = req.store.SaveMetadata(ctx, req.metadata)
if err != nil {
return nil, err
}
}
if notificationErr != nil {
return nil, notificationErr
}
return &ReportResult{
ModuleSnapshot: req.moduleSnapshot,
@@ -728,7 +749,8 @@ func generateTextTemplateReport(ctx context.Context, req generatedReportRequest)
DataPackagePath: req.dataPackagePath,
PreflightPath: req.preflightPath,
ReportPath: reportPath,
OutputPath: reportPath,
OutputPath: outputPath,
NotificationPath: notificationPath,
Metadata: req.metadata,
MetadataPath: metadataPath,
RecentChanges: req.recentChanges,
@@ -738,6 +760,7 @@ func generateTextTemplateReport(ctx context.Context, req generatedReportRequest)
GeneratedTextResultPath: generatedTextResultPath,
GeneratedTextPath: generatedTextPath,
RenderContextPath: renderContextPath,
Notification: notification,
}, nil
}