@@ -237,7 +237,7 @@ func (m *Message) BuildComment(
237
237
}
238
238
239
239
updateWritten := false
240
- for _ , appName := range names {
240
+ for appIndex , appName := range names {
241
241
if m .isDeleted (appName ) {
242
242
continue
243
243
}
@@ -329,8 +329,8 @@ func (m *Message) BuildComment(
329
329
comments = append (comments , sb .String ())
330
330
sb .Reset ()
331
331
sb .WriteString (header )
332
- sb .WriteString (appHeader )
333
332
contentLength = len (continuedHeader )
333
+ sb .WriteString (appHeader )
334
334
contentLength += len (appHeader )
335
335
msg = secondPart
336
336
} else {
@@ -341,9 +341,16 @@ func (m *Message) BuildComment(
341
341
}
342
342
}
343
343
344
- // Close the app details block
345
- sb .WriteString ("\n </details>\n " )
346
- contentLength += len ("\n </details>\n " )
344
+ // Don't write if there's no more apps to write. An unclosed details tag wouldn't cause an issue
345
+ // unless there's more contents to write
346
+ if appIndex < len (names )- 1 {
347
+ closingDetailsTag := "\n </details>\n "
348
+ if contentLength + len (closingDetailsTag ) > maxContentLength {
349
+ appendChunk (appHeader )
350
+ } // Close the app details block
351
+ sb .WriteString (closingDetailsTag )
352
+ contentLength += len (closingDetailsTag )
353
+ }
347
354
348
355
updateWritten = true
349
356
}
0 commit comments