@@ -3,6 +3,7 @@ import { IS_GITHUB_ACTION, GITHUB_ACTION_JOB_URL } from "./constants.ts";
33import { getOctokit } from "./octokit.ts" ;
44import { codeBlock } from "./utilities.ts" ;
55import { inspect } from "node:util" ;
6+ import { outdent } from "outdent" ;
67
78type Comment = Awaited < ReturnType < typeof createComment > > ;
89
@@ -27,14 +28,20 @@ async function updateComment(body: string, comment: Comment) {
2728}
2829
2930let briefCommentRequest : ReturnType < typeof createComment > | undefined ;
30- export async function brief ( body : string ) {
31- console . log ( body ) ;
31+ const messages : { time : Date ; message : string } [ ] = [ ] ;
32+ export async function brief ( message : string ) {
33+ console . log ( message ) ;
3234
3335 if ( ! IS_GITHUB_ACTION ) {
3436 return ;
3537 }
3638
37- body += `\n__[details](${ GITHUB_ACTION_JOB_URL } )__` ;
39+ messages . push ( { time : new Date ( ) , message } ) ;
40+
41+ const body = outdent `
42+ ${ messages . map ( ( { time, message } ) => `[${ time } }]: ${ message } ]` ) . join ( "\n\n" ) }
43+ __[details](${ GITHUB_ACTION_JOB_URL } )__
44+ ` ;
3845
3946 if ( briefCommentRequest ) {
4047 const comment = await briefCommentRequest ;
@@ -55,10 +62,11 @@ export async function error(error: Error) {
5562 return ;
5663 }
5764
58- const text = `
59- ## [${ error . name } ]
65+ const text = outdent `
66+ <details><summary> [${ error . name } ]( ${ error . message } )</summary>
6067
6168 ${ codeBlock ( inspect ( error ) ) }
69+ </details>
6270 ` ;
6371 return await brief ( text ) ;
6472}
0 commit comments