@@ -19,6 +19,7 @@ Deno.test("1 section gantt", async (t) => {
19
19
"workflow_id" : 66989622 ,
20
20
"created_at" : "2023-08-25T15:57:51Z" ,
21
21
"updated_at" : "2023-08-25T15:58:19Z" ,
22
+ "run_started_at" : "2023-08-25T15:57:51Z" ,
22
23
} as unknown as Workflow ;
23
24
24
25
const workflowJobs = [ {
@@ -133,6 +134,7 @@ ${workflowJobs[0].steps![7].name} (0s) :job0-8, after job0-7, 0s
133
134
"workflow_id" : 66989622 ,
134
135
"created_at" : "2023-08-25T15:57:51Z" ,
135
136
"updated_at" : "2023-08-25T15:58:19Z" ,
137
+ "run_started_at" : "2023-08-25T15:57:51Z" ,
136
138
} as unknown as Workflow ;
137
139
138
140
const workflowJobs = [ {
@@ -210,6 +212,7 @@ ${workflowJobs[0].steps![3].name} (0s) :job0-4, after job0-3, 0s
210
212
"conclusion" : null ,
211
213
"created_at" : "2023-09-24T15:41:23Z" ,
212
214
"updated_at" : "2023-09-24T15:46:01Z" ,
215
+ "run_started_at" : "2023-09-24T15:41:23Z" ,
213
216
} as unknown as Workflow ;
214
217
215
218
const workflowJobs = [ {
@@ -279,6 +282,7 @@ ${workflowJobs[0].steps![0].name} (1s) :job0-1, after job0-0, 1s
279
282
"workflow_id" : 69674074 ,
280
283
"created_at" : "2023-09-25T15:55:47Z" ,
281
284
"updated_at" : "2023-09-25T15:57:36Z" ,
285
+ "run_started_at" : "2023-09-25T15:55:47Z" ,
282
286
} as unknown as Workflow ;
283
287
284
288
const workflowJobs = [ {
@@ -339,6 +343,81 @@ ${workflowJobs[0].steps![2].name} (0s) :job0-3, after job0-2, 0s
339
343
assertEquals ( createGantt ( workflow , workflowJobs ) , expect ) ;
340
344
} ,
341
345
) ;
346
+
347
+ await t . step ( "retried job" , ( ) => {
348
+ const workflow = {
349
+ "id" : 5833450919 ,
350
+ "name" : "Check self-hosted runner" ,
351
+ "run_number" : 128 ,
352
+ "event" : "workflow_dispatch" ,
353
+ "status" : "completed" ,
354
+ "conclusion" : "success" ,
355
+ "workflow_id" : 10970418 ,
356
+ // Retried job does not changed created_at but changed run_started_at.
357
+ // This dummy simulate to retry job after 1 hour.
358
+ "created_at" : "2023-08-11T13:00:48Z" ,
359
+ "updated_at" : "2023-08-11T14:01:56Z" ,
360
+ "run_started_at" : "2023-08-11T14:00:48Z" ,
361
+ "run_attempt" : 2 ,
362
+ } as unknown as Workflow ;
363
+
364
+ const workflowJobs = [
365
+ {
366
+ "id" : 15820938470 ,
367
+ "run_id" : 5833450919 ,
368
+ "workflow_name" : "Check self-hosted runner" ,
369
+ "status" : "completed" ,
370
+ "conclusion" : "success" ,
371
+ "created_at" : "2023-08-11T14:00:50Z" ,
372
+ "started_at" : "2023-08-11T14:01:31Z" ,
373
+ "completed_at" : "2023-08-11T14:01:36Z" ,
374
+ "name" : "node" ,
375
+ "steps" : [
376
+ {
377
+ "name" : "Set up job" ,
378
+ "status" : "completed" ,
379
+ "conclusion" : "success" ,
380
+ "number" : 1 ,
381
+ "started_at" : "2023-08-11T23:01:30.000+09:00" ,
382
+ "completed_at" : "2023-08-11T23:01:32.000+09:00" ,
383
+ } ,
384
+ {
385
+ "name" : "Set up runner" ,
386
+ "status" : "completed" ,
387
+ "conclusion" : "success" ,
388
+ "number" : 2 ,
389
+ "started_at" : "2023-08-11T23:01:32.000+09:00" ,
390
+ "completed_at" : "2023-08-11T23:01:32.000+09:00" ,
391
+ } ,
392
+ {
393
+ "name" : "Run actions/checkout@v3" ,
394
+ "status" : "completed" ,
395
+ "conclusion" : "success" ,
396
+ "number" : 3 ,
397
+ "started_at" : "2023-08-11T23:01:34.000+09:00" ,
398
+ "completed_at" : "2023-08-11T23:01:34.000+09:00" ,
399
+ } ,
400
+ ] ,
401
+ } ,
402
+ ] as unknown as WorkflowJobs ;
403
+
404
+ // deno-fmt-ignore
405
+ const expect = `
406
+ \`\`\`mermaid
407
+ gantt
408
+ title ${ workflowJobs [ 0 ] . workflow_name }
409
+ dateFormat HH:mm:ss
410
+ axisFormat %H:%M:%S
411
+ section ${ workflowJobs [ 0 ] . name }
412
+ Waiting for a runner (41s) :active, job0-0, 00:00:02, 41s
413
+ ${ workflowJobs [ 0 ] . steps ! [ 0 ] . name } (2s) :job0-1, after job0-0, 2s
414
+ ${ workflowJobs [ 0 ] . steps ! [ 1 ] . name } (0s) :job0-2, after job0-1, 0s
415
+ ${ workflowJobs [ 0 ] . steps ! [ 2 ] . name } (0s) :job0-3, after job0-2, 0s
416
+ \`\`\`
417
+ ` ;
418
+
419
+ assertEquals ( createGantt ( workflow , workflowJobs ) , expect ) ;
420
+ } ) ;
342
421
} ) ;
343
422
344
423
Deno . test ( "2 section gantt" , async ( t ) => {
@@ -353,6 +432,7 @@ Deno.test("2 section gantt", async (t) => {
353
432
"workflow_id" : 10970418 ,
354
433
"created_at" : "2023-08-11T14:00:48Z" ,
355
434
"updated_at" : "2023-08-11T14:01:56Z" ,
435
+ "run_started_at" : "2023-08-11T14:00:48Z" ,
356
436
} as unknown as Workflow ;
357
437
358
438
const workflowJobs = [
@@ -547,6 +627,7 @@ ${workflowJobs[1].steps![6].name} (0s) :job1-7, after job1-6, 0s
547
627
"workflow_id" : 10970418 ,
548
628
"created_at" : "2023-08-11T14:00:48Z" ,
549
629
"updated_at" : "2023-08-11T14:01:56Z" ,
630
+ "run_started_at" : "2023-08-11T14:00:48Z" ,
550
631
} as unknown as Workflow ;
551
632
552
633
const workflowJobs = [
0 commit comments