@@ -24,6 +24,10 @@ var AggregateResultsCmd = &cobra.Command{
2424 maxPassRatio , _ := cmd .Flags ().GetFloat64 ("max-pass-ratio" )
2525 codeOwnersPath , _ := cmd .Flags ().GetString ("codeowners-path" )
2626 repoPath , _ := cmd .Flags ().GetString ("repo-path" )
27+ repoURL , _ := cmd .Flags ().GetString ("repo-url" )
28+ headSHA , _ := cmd .Flags ().GetString ("head-sha" )
29+ baseSHA , _ := cmd .Flags ().GetString ("base-sha" )
30+ githubWorkflowName , _ := cmd .Flags ().GetString ("github-workflow-name" )
2731
2832 // Ensure the output directory exists
2933 if err := fs .MkdirAll (outputDir , 0755 ); err != nil {
@@ -51,6 +55,13 @@ var AggregateResultsCmd = &cobra.Command{
5155
5256 // Aggregate the reports
5357 aggregatedReport , err := reports .Aggregate (testReports ... )
58+
59+ // Add metadata to the aggregated report
60+ aggregatedReport .HeadSHA = headSHA
61+ aggregatedReport .BaseSHA = baseSHA
62+ aggregatedReport .RepoURL = repoURL
63+ aggregatedReport .GitHubWorkflowName = githubWorkflowName
64+
5465 if err != nil {
5566 s .Stop ()
5667 return fmt .Errorf ("error aggregating test reports: %w" , err )
@@ -98,12 +109,15 @@ var AggregateResultsCmd = &cobra.Command{
98109
99110 // Create a new report for failed tests with logs
100111 failedReportWithLogs := & reports.TestReport {
101- GoProject : aggregatedReport .GoProject ,
102- TestRunCount : aggregatedReport .TestRunCount ,
103- RaceDetection : aggregatedReport .RaceDetection ,
104- ExcludedTests : aggregatedReport .ExcludedTests ,
105- SelectedTests : aggregatedReport .SelectedTests ,
106- Results : failedTests ,
112+ GoProject : aggregatedReport .GoProject ,
113+ TestRunCount : aggregatedReport .TestRunCount ,
114+ RaceDetection : aggregatedReport .RaceDetection ,
115+ ExcludedTests : aggregatedReport .ExcludedTests ,
116+ SelectedTests : aggregatedReport .SelectedTests ,
117+ HeadSHA : aggregatedReport .HeadSHA ,
118+ BaseSHA : aggregatedReport .BaseSHA ,
119+ GitHubWorkflowName : aggregatedReport .GitHubWorkflowName ,
120+ Results : failedTests ,
107121 }
108122
109123 // Save the failed tests report with logs
@@ -171,6 +185,10 @@ func init() {
171185 AggregateResultsCmd .Flags ().Float64P ("max-pass-ratio" , "" , 1.0 , "The maximum pass ratio threshold for a test to be considered flaky" )
172186 AggregateResultsCmd .Flags ().StringP ("codeowners-path" , "" , "" , "Path to the CODEOWNERS file" )
173187 AggregateResultsCmd .Flags ().StringP ("repo-path" , "" , "." , "The path to the root of the repository/project" )
188+ AggregateResultsCmd .Flags ().String ("repo-url" , "" , "The repository URL" )
189+ AggregateResultsCmd .Flags ().String ("head-sha" , "" , "Head commit SHA for the test report" )
190+ AggregateResultsCmd .Flags ().String ("base-sha" , "" , "Base commit SHA for the test report" )
191+ AggregateResultsCmd .Flags ().String ("github-workflow-name" , "" , "GitHub workflow name for the test report" )
174192
175193 AggregateResultsCmd .MarkFlagRequired ("results-path" )
176194}
0 commit comments