@@ -151,9 +151,9 @@ const sfc = {
151151 POST (` ${ this .run .link } /approve` );
152152 },
153153
154- createLogLine (line , startTime , stepIndex ) {
154+ createLogLine (line , startTime , stepIndex , {classNames, wrappings} = {} ) {
155155 const div = document .createElement (' div' );
156- div .classList .add (' job-log-line' );
156+ div .classList .add (' job-log-line' , ... classNames );
157157 div .setAttribute (' id' , ` jobstep-${ stepIndex} -${ line .index } ` );
158158 div ._jobLogTime = line .timestamp ;
159159
@@ -179,19 +179,50 @@ const sfc = {
179179
180180 const logMessage = document .createElement (' span' );
181181 logMessage .className = ' log-msg' ;
182- logMessage .innerHTML = renderAnsi (line .message );
183- div .append (logTimeStamp);
184- div .append (logMessage);
185- div .append (logTimeSeconds);
186182
183+ let html = renderAnsi (line .message );
184+ for (const [before , after ] of wrappings) {
185+ html = ` ${ before}${ html}${ after} ` ;
186+ }
187+ logMessage .innerHTML = html;
188+
189+ div .append (logTimeStamp, logMessage, logTimeSeconds);
187190 return div;
188191 },
189192
193+ getLineHTML ({message, index, timestamp}, startTime , stepIndex ) {
194+ const wrappings = [];
195+ const classNames = [];
196+
197+ if (message .startsWith (' ::endgroup' )) {
198+ classNames .push (' endgroup' );
199+ } else if (message .startsWith (' ::add-matcher' )) {
200+ classNames .push (' add-matcher' );
201+ } else if (message .startsWith (' ::remove-matcher' )) {
202+ classNames .push (' remove-matcher' );
203+ } else {
204+ if (message .startsWith (' ::group::' )) {
205+ message = message .substring (9 );
206+ wrappings .push ([' <details><summary>' , ' </summary></details>' ]);
207+ }
208+ if (message .startsWith (' ::error::' )) {
209+ message = message .substring (9 );
210+ wrappings .push ([' <span class="tw-text-red">' , ' </span>' ]);
211+ }
212+ if (message .startsWith (' [command]' )) {
213+ message = message .substring (9 );
214+ wrappings .push ([' <span class="tw-text-blue">' , ' </span>' ]);
215+ }
216+ }
217+
218+ return this .createLogLine ({message, index, timestamp}, startTime, stepIndex, {classNames, wrappings});
219+ },
220+
190221 appendLogs (stepIndex , logLines , startTime ) {
222+ const el = this .getLogsContainer (stepIndex);
223+
191224 for (const line of logLines) {
192- // TODO: group support: ##[group]GroupTitle , ##[endgroup]
193- const el = this .getLogsContainer (stepIndex);
194- el .append (this .createLogLine (line, startTime, stepIndex));
225+ el .append (this .getLineHTML (line, startTime, stepIndex));
195226 }
196227 },
197228
@@ -789,6 +820,12 @@ export function initRepositoryActionView() {
789820 scroll- margin- top: 95px ;
790821}
791822
823+ .job - log- line .add - matcher,
824+ .job - log- line .remove - matcher,
825+ .job - log- line .endgroup {
826+ display: none ! important;
827+ }
828+
792829/* class names 'log-time-seconds' and 'log-time-stamp' are used in the method toggleTimeDisplay */
793830.job - log- line .line - num, .log - time- seconds {
794831 width: 48px ;
0 commit comments