2626import java .util .Arrays ;
2727import java .util .List ;
2828import java .util .Collections ;
29+ import java .util .stream .Collectors ;
2930
3031@ Command (name = "report" , mixinStandardHelpOptions = true ,
3132 description = "Raises and closes issues depending on the results of bad image checking" )
@@ -118,6 +119,9 @@ private void closeResolvedIssues(GitHub github, List<BadImage> links) throws IOE
118119 }
119120 }
120121
122+ private String getOwningPages (String [] slugs ) {
123+ return Arrays .stream (slugs ).map (slug -> siteUrl + "/" + slug ).collect (Collectors .joining ("\n - " ));
124+ }
121125
122126 private void processBadImage (GitHub github , BadImage link ) {
123127 try {
@@ -135,18 +139,19 @@ private void processBadImage(GitHub github, BadImage link) {
135139
136140 // If there's no matching defect ...
137141 if (answer .getTotalCount () == 0 ) {
138- String title = String .format ("Invalid image: %s" , link .url );
139- // Eventually, we would like to customise the message depending on the exact nature of the broken link.
140- // For now, just do something generic.
142+ String title = String .format ("%s image: %s" , link .reason , link .url );
141143 String body = String .format ("""
142- Invalid image: %s
144+ %s image: %s
143145
144- The problem image was found on %s
146+ The problem image was found on these artifacts: %s
147+
148+ Affected pages are
149+ - %s
145150
146151 This issue was auto-created by the bad image helper.
147152
148153 --- %s --- Do not remove this line or the bad image helper will not be able to manage this issue
149- """ , link .url , link .artifact , EYECATCHER );
154+ """ , link .reason , link . url , Arrays . toString ( link .artifacts ), getOwningPages ( link . slugs ) , EYECATCHER );
150155
151156 if (!dryRun ) {
152157 GHIssue issue = repository .createIssue (title )
@@ -193,6 +198,8 @@ public static void main(String... args) {
193198
194199 record BadImage (
195200 String url ,
196- String artifact ) {
201+ String reason ,
202+ String [] artifacts ,
203+ String [] slugs ) {
197204 }
198205}
0 commit comments