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: 5 additions & 5 deletions report_github_metrics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
require 'date'
require 'json'

def collect_metrics(jobs, tags)
def collect_metrics(workflow, jobs, tags)
jobs.map{|job| collect_job_metrics(job, tags)}.compact + \
collect_workflow_metrics(jobs, tags)
collect_workflow_metrics(workflow, jobs, tags)
end

def collect_job_metrics(job, tags)
Expand All @@ -18,8 +18,8 @@ def collect_job_metrics(job, tags)
]
end

def collect_workflow_metrics(jobs, tags)
start = jobs.min_by{|job| job["started_at"]}["started_at"]
def collect_workflow_metrics(workflow, jobs, tags)
start = workflow["run_started_at"]
finish = jobs.max_by{|job| job["completed_at"]}["completed_at"]
status = if jobs.any?{|job| job["conclusion"] == "cancelled"}
"cancelled"
Expand Down Expand Up @@ -93,7 +93,7 @@ def collect_duration_data(github_client, repo, run)
if TAGGED_BRANCHES != []
tags += ["branch:#{TAGGED_BRANCHES.include?(branch) ? branch : "other" }"]
end
collect_metrics(jobs, tags)
collect_metrics(workflow, jobs, tags)
end

def parse_array_input(arg)
Expand Down