Skip to content

Commit

Permalink
wip! include run duration
Browse files Browse the repository at this point in the history
  • Loading branch information
tsibley committed Feb 14, 2024
1 parent 10a5011 commit f33d6f9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ process.stdout.write(String(html`
<summary>${indicator(run)}</summary>
<div>
<time datetime="${run.created_at}">${run.created_at}</time>
<time datetime="${run.duration}">${run.duration}</time>
<a href="${run.html_url}">run details</a>
<code>${run.event}</code>
<code>${run.commit_id.slice(0, 8)}</code>
Expand Down
7 changes: 5 additions & 2 deletions workflow-runs.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,14 @@ window.addEventListener("popstate", (event) => {
});


/* Gracefully upgrade datetimes to user's local time
/* Gracefully upgrade datetimes to user's local time and ISO durations to
* user-friendly descriptions.
*/
for (const time of document.getElementsByTagName("time")) {
if (time.dateTime === time.textContent) {
time.textContent = new Date(time.dateTime);
time.textContent = time.dateTime.startsWith("P")
? luxon.Duration.fromISO(time.dateTime).toHuman()
: new Date(time.dateTime);
}
}

Expand Down
6 changes: 6 additions & 0 deletions workflow-runs.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* legwork to get their status.
* -trs, 8 Sept 2023
*/
set intervalstyle = 'iso_8601';

with

Expand Down Expand Up @@ -82,8 +83,13 @@ run as materialized (
run.id as id,
run.html_url,
run.created_at,
run.updated_at,
run.conclusion,
run.status,
case when run.conclusion is not null
then run.updated_at - run.created_at
else current_timestamp(0) - run.created_at
end as duration,
run.event,
run.head_sha as commit_id,
run.head_commit->>'message' as commit_msg,
Expand Down

0 comments on commit f33d6f9

Please sign in to comment.