Skip to content

Commit e072ede

Browse files
authored
Bug fix: report workflow status as cancelled if any of the jobs is cancelled (#25)
1 parent f3f359a commit e072ede

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

report_github_metrics.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,13 @@ def collect_job_metrics(job, tags)
2121
def collect_workflow_metrics(jobs, tags)
2222
start = jobs.min_by{|job| job["started_at"]}["started_at"]
2323
finish = jobs.max_by{|job| job["completed_at"]}["completed_at"]
24-
status = jobs.all?{|job| ["success", "skipped"].include? job["conclusion"]} ? "success" : "failure"
24+
status = if jobs.any?{|job| job["conclusion"] == "cancelled"}
25+
"cancelled"
26+
elsif jobs.all?{|job| ["success", "skipped"].include? job["conclusion"]}
27+
"success"
28+
else
29+
"failure"
30+
end
2531
[[
2632
"workflow_duration",
2733
finish - start,

0 commit comments

Comments
 (0)