@@ -21,7 +21,7 @@ let newTscResolvedVersion: string | undefined;
21
21
let oldTscResolvedVersion : string | undefined ;
22
22
23
23
let somethingChanged = false ;
24
- let infrastructureFailed = false ;
24
+ const infrastructureFailures = new Map < RepoStatus , number > ( ) ;
25
25
26
26
for ( const path of metadataFilePaths ) {
27
27
const metadata : Metadata = JSON . parse ( fs . readFileSync ( path , { encoding : "utf-8" } ) ) ;
@@ -38,21 +38,32 @@ for (const path of metadataFilePaths) {
38
38
somethingChanged = true ;
39
39
break ;
40
40
default :
41
- infrastructureFailed = true ;
41
+ infrastructureFailures . set ( status , ( infrastructureFailures . get ( status ) ?? 0 ) + 1 )
42
42
break ;
43
43
}
44
44
}
45
45
}
46
46
47
- let summary : string ;
48
- if ( somethingChanged && ( isTopReposRun || ! infrastructureFailed ) ) {
49
- summary = `Something interesting changed - please have a look.` ;
47
+ const summary : string [ ] = [ ] ;
48
+
49
+ // In a top-repos run, the test set is arbitrary, so we ignore infrastructure failures
50
+ // as it's possible that there's a repo that just doesn't work.
51
+ if ( ! isTopReposRun && infrastructureFailures . size ) {
52
+ summary . push ( "There were infrastructure failures potentially unrelated to your change:" ) ;
53
+ summary . push ( "" ) ;
54
+ for ( const [ status , count ] of infrastructureFailures ) {
55
+ summary . push ( `- ${ count } ${ count === 1 ? "instance" : "instances" } of "${ status } "` ) ;
56
+ }
57
+ summary . push ( "" ) ;
58
+ summary . push ( "Otherwise..." ) ;
59
+ summary . push ( "" ) ;
50
60
}
51
- else if ( infrastructureFailed && ! isTopReposRun ) {
52
- summary = `Unfortunately, something went wrong, but it probably wasn't caused by your change.` ;
61
+
62
+ if ( somethingChanged ) {
63
+ summary . push ( "Something interesting changed - please have a look." ) ;
53
64
}
54
65
else {
55
- summary = ` Everything looks good!` ;
66
+ summary . push ( " Everything looks good!" ) ;
56
67
}
57
68
58
69
const resultPaths = pu . glob ( resultDirPath , `**/*.${ resultFileNameSuffix } ` ) . sort ( ( a , b ) => path . basename ( a ) . localeCompare ( path . basename ( b ) ) ) ;
@@ -61,7 +72,7 @@ const outputs = resultPaths.map(p => fs.readFileSync(p, { encoding: "utf-8" }).r
61
72
const suiteDescription = isTopReposRun ? "top-repos" : "user test" ;
62
73
let header = `@${ userToTag } Here are the results of running the ${ suiteDescription } suite comparing \`${ oldTscResolvedVersion } \` and \`${ newTscResolvedVersion } \`:
63
74
64
- ${ summary } `;
75
+ ${ summary . join ( "\n" ) } `;
65
76
66
77
if ( ! outputs . length ) {
67
78
git . createComment ( + prNumber , + commentNumber , postResult , [ header ] ) ;
0 commit comments