Add percentage on result title (#4)

* Add percentage to action name

* Test with percentage in output title
This commit is contained in:
Abimael Martell 2020-10-04 10:10:13 -07:00 committed by GitHub
parent 2454e13902
commit b8506db951
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 5 deletions

View File

@ -18,6 +18,7 @@ class GithubCheckRunService
@summary = @report_adapter.summary(@report) @summary = @report_adapter.summary(@report)
@annotations = @report_adapter.annotations(@report) @annotations = @report_adapter.annotations(@report)
@conclusion = @report_adapter.conslusion(@report) @conclusion = @report_adapter.conslusion(@report)
@percent = @report_adapter.lines_covered_percent(@report)
@client.patch( @client.patch(
"#{endpoint_url}/#{id}", "#{endpoint_url}/#{id}",
@ -48,7 +49,7 @@ class GithubCheckRunService
completed_at: Time.now.iso8601, completed_at: Time.now.iso8601,
conclusion: @conclusion, conclusion: @conclusion,
output: { output: {
title: CHECK_NAME, title: "#{CHECK_NAME} #{@percent}%",
summary: @summary, summary: @summary,
annotations: @annotations annotations: @annotations
} }

View File

@ -18,16 +18,16 @@ class ReportAdapter
[] []
end end
def lines_covered_percent(report)
@lines_covered_percent ||= report.dig('lines', 'covered_percent')
end
private private
def table_head def table_head
"| Type | covered | minimum |\n| ----- | ------- | ------- |" "| Type | covered | minimum |\n| ----- | ------- | ------- |"
end end
def lines_covered_percent(report)
@lines_covered_percent ||= report.dig('lines', 'covered_percent')
end
def lines_minimum_percent(report) def lines_minimum_percent(report)
@lines_minimum_percent ||= report.dig('lines', 'minumum_percent') @lines_minimum_percent ||= report.dig('lines', 'minumum_percent')
end end