Skip to content

Commit f05fd9e

Browse files
authored
Merge pull request #2233 from Urgau/gha-logs-chrome-copy
Prefer pseudo-elements to avoid copying the timestamps
2 parents ab99cdc + 8a10266 commit f05fd9e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/gha_logs.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,9 @@ pub async fn gha_logs(
212212
<title>{job_name} - {owner}/{repo}@{short_sha}</title>
213213
{icon_status}
214214
<style>
215+
[data-pseudo-content]::before {{
216+
content: attr(data-pseudo-content);
217+
}}
215218
body {{
216219
font: 14px SFMono-Regular, Consolas, Liberation Mono, Menlo, monospace;
217220
background: #0C0C0C;
@@ -224,7 +227,6 @@ table {{
224227
}}
225228
.timestamp {{
226229
color: #848484;
227-
user-select: none;
228230
text-decoration: none;
229231
}}
230232
.timestamp:hover {{
@@ -289,7 +291,7 @@ table {{
289291
// self-referencial anchor.
290292
const tsRegex = /^(\d{{4}}-\d{{2}}-\d{{2}}T\d{{2}}:\d{{2}}:\d{{2}}\.\d+Z) (.*)(\n)?/gm;
291293
html = html.replace(tsRegex, (match, ts, log) =>
292-
`<tr><td><a id="${{ts}}" href="#${{ts}}" class="timestamp">${{ts}}</a></td><td>${{log}}</td></tr>`
294+
`<tr><td><a id="${{ts}}" href="#${{ts}}" class="timestamp" data-pseudo-content="${{ts}}"></a></td><td>${{log}}</td></tr>`
293295
);
294296
295297
// 4. Add a anchor around every "##[error]" string

0 commit comments

Comments
 (0)