From abd4aff55b76ed93a1e627fc6e11fb3225bc0f29 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Wed, 14 Apr 2021 12:10:17 +0200 Subject: [PATCH] properly get default values for report_name rename field to report_name --- action.yml | 3 +++ lib/github_check_run_service.rb | 8 +++----- lib/index.rb | 3 ++- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/action.yml b/action.yml index 673b54e..b8c4ad1 100644 --- a/action.yml +++ b/action.yml @@ -15,6 +15,9 @@ inputs: min_coverage: description: "Minimum coverage" default: "80" + report_name: + description: "Name of the github action check" + default: "Coverage" result_path: description: "Json with coverage result" required: true diff --git a/lib/github_check_run_service.rb b/lib/github_check_run_service.rb index c7c1fcb..b2287cf 100644 --- a/lib/github_check_run_service.rb +++ b/lib/github_check_run_service.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true class GithubCheckRunService - CHECK_NAME = defined? @github_data[:name] ? @github_data[:name] : 'Coverage' - def initialize(report, github_data, report_adapter) @report = report @github_data = github_data @@ -34,7 +32,7 @@ class GithubCheckRunService def create_check_payload { - name: CHECK_NAME, + name: @report_name, head_sha: @github_data[:sha], status: 'in_progress', started_at: Time.now.iso8601 @@ -43,13 +41,13 @@ class GithubCheckRunService def update_check_payload { - name: CHECK_NAME, + name: @report_name, head_sha: @github_data[:sha], status: 'completed', completed_at: Time.now.iso8601, conclusion: @conclusion, output: { - title: "#{CHECK_NAME} #{@percent}%", + title: "#{@report_name} #{@percent}%", summary: @summary, annotations: @annotations } diff --git a/lib/index.rb b/lib/index.rb index e888441..67c3003 100644 --- a/lib/index.rb +++ b/lib/index.rb @@ -17,11 +17,12 @@ end sha: ENV['GITHUB_SHA'], token: ENV['INPUT_TOKEN'], 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'] @report_path = ENV['INPUT_RESULT_PATH'] +@report_name: ENV['INPUT_REPORT_NAME'] @data = { min: ENV['INPUT_MIN_COVERAGE'] } @report = CoverageReport.generate(@coverage_type, @report_path, @data)