Skip to content

Commit b8506db

Browse files
Add percentage on result title (#4)
* Add percentage to action name * Test with percentage in output title
1 parent 2454e13 commit b8506db

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

lib/github_check_run_service.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ def run
1818
@summary = @report_adapter.summary(@report)
1919
@annotations = @report_adapter.annotations(@report)
2020
@conclusion = @report_adapter.conslusion(@report)
21+
@percent = @report_adapter.lines_covered_percent(@report)
2122

2223
@client.patch(
2324
"#{endpoint_url}/#{id}",
@@ -48,7 +49,7 @@ def update_check_payload
4849
completed_at: Time.now.iso8601,
4950
conclusion: @conclusion,
5051
output: {
51-
title: CHECK_NAME,
52+
title: "#{CHECK_NAME} #{@percent}%",
5253
summary: @summary,
5354
annotations: @annotations
5455
}

lib/report_adapter.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@ def annotations(_report)
1818
[]
1919
end
2020

21+
def lines_covered_percent(report)
22+
@lines_covered_percent ||= report.dig('lines', 'covered_percent')
23+
end
24+
2125
private
2226

2327
def table_head
2428
"| Type | covered | minimum |\n| ----- | ------- | ------- |"
2529
end
2630

27-
def lines_covered_percent(report)
28-
@lines_covered_percent ||= report.dig('lines', 'covered_percent')
29-
end
30-
3131
def lines_minimum_percent(report)
3232
@lines_minimum_percent ||= report.dig('lines', 'minumum_percent')
3333
end

0 commit comments

Comments
 (0)