Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/gha_logs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,11 @@ body {{
font: 14px SFMono-Regular, Consolas, Liberation Mono, Menlo, monospace;
background: #0C0C0C;
color: #CCC;
}}
table {{
white-space: pre;
table-layout: fixed;
width: 100%;
}}
.timestamp {{
color: #848484;
Expand Down Expand Up @@ -275,14 +279,14 @@ body {{
html = html.replace(/^\uFEFF/gm, "");

// 3. Transform each log lines that doesn't start with a timestamp into a row where everything is in the second column
const untsRegex = /^(?!\d{{4}}-\d{{2}}-\d{{2}}T\d{{2}}:\d{{2}}:\d{{2}}\.\d+Z)(.*)$/gm;
const untsRegex = /^(?!\d{{4}}-\d{{2}}-\d{{2}}T\d{{2}}:\d{{2}}:\d{{2}}\.\d+Z)(.*)(\r?\n)?/gm;
html = html.replace(untsRegex, (match, log) =>
`<tr><td></td><td>${{log}}</td></tr>`
);

// 3.b Transform each log lines that start with a timestamp in a row with two columns and make the timestamp be a
// self-referencial anchor.
const tsRegex = /^(\d{{4}}-\d{{2}}-\d{{2}}T\d{{2}}:\d{{2}}:\d{{2}}\.\d+Z) (.*)$/gm;
const tsRegex = /^(\d{{4}}-\d{{2}}-\d{{2}}T\d{{2}}:\d{{2}}:\d{{2}}\.\d+Z) (.*)(\r?\n)?/gm;
html = html.replace(tsRegex, (match, ts, log) =>
`<tr><td><a id="${{ts}}" href="#${{ts}}" class="timestamp">${{ts}}</a></td><td>${{log}}</td></tr>`
);
Expand Down Expand Up @@ -358,7 +362,7 @@ body {{
</script>
</head>
<body>
<table style="table-layout: fixed; width: 100%">
<table>
<colgroup>
<col style="width: 29ch">
<col style="width: 100%">
Expand Down
Loading