44require 'date'
55require 'json'
66
7- def collect_metrics ( jobs , tags )
7+ def collect_metrics ( workflow , jobs , tags )
88 jobs . map { |job | collect_job_metrics ( job , tags ) } . compact + \
9- collect_workflow_metrics ( jobs , tags )
9+ collect_workflow_metrics ( workflow , jobs , tags )
1010end
1111
1212def collect_job_metrics ( job , tags )
@@ -18,8 +18,8 @@ def collect_job_metrics(job, tags)
1818 ]
1919end
2020
21- def collect_workflow_metrics ( jobs , tags )
22- start = jobs . min_by { | job | job [ "started_at" ] } [ "started_at "]
21+ def collect_workflow_metrics ( workflow , jobs , tags )
22+ start = workflow [ "run_started_at "]
2323 finish = jobs . max_by { |job | job [ "completed_at" ] } [ "completed_at" ]
2424 status = if jobs . any? { |job | job [ "conclusion" ] == "cancelled" }
2525 "cancelled"
@@ -93,7 +93,7 @@ def collect_duration_data(github_client, repo, run)
9393 if TAGGED_BRANCHES != [ ]
9494 tags += [ "branch:#{ TAGGED_BRANCHES . include? ( branch ) ? branch : "other" } " ]
9595 end
96- collect_metrics ( jobs , tags )
96+ collect_metrics ( workflow , jobs , tags )
9797end
9898
9999def parse_array_input ( arg )
0 commit comments