File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -129,7 +129,7 @@ async fn process_logs(
129
129
let nonce = Uuid :: new_v4 ( ) . to_hyphenated ( ) . to_string ( ) ;
130
130
131
131
let html = format ! (
132
- r##"<!DOCTYPE html>
132
+ r### "<!DOCTYPE html>
133
133
<html>
134
134
<head>
135
135
<title>{log_uuid} - triagebot</title>
@@ -171,13 +171,28 @@ async fn process_logs(
171
171
`<a id="${{ts}}" href="#${{ts}}" class="timestamp">${{ts}}</a>`
172
172
);
173
173
174
+ // 4. Add a anchor around every "##[error]" string
175
+ let errorCounter = -1;
176
+ html = html.replace(/##\[error\]/g, () =>
177
+ `<a id="error-${{++errorCounter}}">##[error]</a>`
178
+ );
179
+
180
+ // 5. Add the html to the DOM
174
181
var cdiv = document.getElementById("console");
175
182
cdiv.innerHTML = html;
183
+
184
+ // 6. If no anchor is given, scroll to the last error
185
+ if (location.hash === "" && errorCounter >= 0) {{
186
+ document.getElementById(`error-${{errorCounter}}`).scrollIntoView({{
187
+ behavior: 'smooth',
188
+ block: 'center'
189
+ }});
190
+ }}
176
191
</script>
177
192
</head>
178
193
<body id="console">
179
194
</body>
180
- </html>"## ,
195
+ </html>"### ,
181
196
) ;
182
197
183
198
tracing:: info!( "gha_logs: serving logs for {log_uuid}" ) ;
You can’t perform that action at this time.
0 commit comments