Skip to content

Commit 4d4ffbe

Browse files
authored
Merge pull request #28 from scribd/kamranf/TOOLS-5639
Fix bug with over-reporting duration of rerun workflows
2 parents 5ae1d1e + 7bf0261 commit 4d4ffbe

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

report_github_metrics.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
require 'date'
55
require '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)
1010
end
1111

1212
def collect_job_metrics(job, tags)
@@ -18,8 +18,8 @@ def collect_job_metrics(job, tags)
1818
]
1919
end
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)
9797
end
9898

9999
def parse_array_input(arg)

0 commit comments

Comments
 (0)