properly get default values for report_name
rename field to report_name
This commit is contained in:
parent
f6604dcfa9
commit
abd4aff55b
@ -15,6 +15,9 @@ inputs:
|
|||||||
min_coverage:
|
min_coverage:
|
||||||
description: "Minimum coverage"
|
description: "Minimum coverage"
|
||||||
default: "80"
|
default: "80"
|
||||||
|
report_name:
|
||||||
|
description: "Name of the github action check"
|
||||||
|
default: "Coverage"
|
||||||
result_path:
|
result_path:
|
||||||
description: "Json with coverage result"
|
description: "Json with coverage result"
|
||||||
required: true
|
required: true
|
||||||
|
|||||||
@ -1,8 +1,6 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class GithubCheckRunService
|
class GithubCheckRunService
|
||||||
CHECK_NAME = defined? @github_data[:name] ? @github_data[:name] : 'Coverage'
|
|
||||||
|
|
||||||
def initialize(report, github_data, report_adapter)
|
def initialize(report, github_data, report_adapter)
|
||||||
@report = report
|
@report = report
|
||||||
@github_data = github_data
|
@github_data = github_data
|
||||||
@ -34,7 +32,7 @@ class GithubCheckRunService
|
|||||||
|
|
||||||
def create_check_payload
|
def create_check_payload
|
||||||
{
|
{
|
||||||
name: CHECK_NAME,
|
name: @report_name,
|
||||||
head_sha: @github_data[:sha],
|
head_sha: @github_data[:sha],
|
||||||
status: 'in_progress',
|
status: 'in_progress',
|
||||||
started_at: Time.now.iso8601
|
started_at: Time.now.iso8601
|
||||||
@ -43,13 +41,13 @@ class GithubCheckRunService
|
|||||||
|
|
||||||
def update_check_payload
|
def update_check_payload
|
||||||
{
|
{
|
||||||
name: CHECK_NAME,
|
name: @report_name,
|
||||||
head_sha: @github_data[:sha],
|
head_sha: @github_data[:sha],
|
||||||
status: 'completed',
|
status: 'completed',
|
||||||
completed_at: Time.now.iso8601,
|
completed_at: Time.now.iso8601,
|
||||||
conclusion: @conclusion,
|
conclusion: @conclusion,
|
||||||
output: {
|
output: {
|
||||||
title: "#{CHECK_NAME} #{@percent}%",
|
title: "#{@report_name} #{@percent}%",
|
||||||
summary: @summary,
|
summary: @summary,
|
||||||
annotations: @annotations
|
annotations: @annotations
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,11 +17,12 @@ end
|
|||||||
sha: ENV['GITHUB_SHA'],
|
sha: ENV['GITHUB_SHA'],
|
||||||
token: ENV['INPUT_TOKEN'],
|
token: ENV['INPUT_TOKEN'],
|
||||||
owner: ENV['GITHUB_REPOSITORY_OWNER'] || @event_json.dig('repository', 'owner', 'login'),
|
owner: ENV['GITHUB_REPOSITORY_OWNER'] || @event_json.dig('repository', 'owner', 'login'),
|
||||||
repo: ENV['GITHUB_REPOSITORY_NAME'] || @event_json.dig('repository', 'name')
|
repo: ENV['GITHUB_REPOSITORY_NAME'] || @event_json.dig('repository', 'name'),
|
||||||
}
|
}
|
||||||
|
|
||||||
@coverage_type = ENV['INPUT_TYPE']
|
@coverage_type = ENV['INPUT_TYPE']
|
||||||
@report_path = ENV['INPUT_RESULT_PATH']
|
@report_path = ENV['INPUT_RESULT_PATH']
|
||||||
|
@report_name: ENV['INPUT_REPORT_NAME']
|
||||||
@data = { min: ENV['INPUT_MIN_COVERAGE'] }
|
@data = { min: ENV['INPUT_MIN_COVERAGE'] }
|
||||||
|
|
||||||
@report = CoverageReport.generate(@coverage_type, @report_path, @data)
|
@report = CoverageReport.generate(@coverage_type, @report_path, @data)
|
||||||
|
|||||||
Reference in New Issue
Block a user