From b2d4a0269403bef78f2fba6f0df153d862c471d3 Mon Sep 17 00:00:00 2001 From: Valentin Kiselev Date: Thu, 23 Feb 2023 11:27:44 +0300 Subject: [PATCH] fix: correct branch name for Github Action --- spec/coverage_reporter/config_spec.cr | 3 ++- src/coverage_reporter/ci/github.cr | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/spec/coverage_reporter/config_spec.cr b/spec/coverage_reporter/config_spec.cr index a1c1b9e2..1d1b8e78 100644 --- a/spec/coverage_reporter/config_spec.cr +++ b/spec/coverage_reporter/config_spec.cr @@ -150,7 +150,8 @@ Spectator.describe CoverageReporter::Config do ENV["GITHUB_REPOSITORY"] = "owner/repo" ENV["GITHUB_RUN_ID"] = "12345" ENV["GITHUB_JOB"] = "test" - ENV["GITHUB_REF_NAME"] = "fix/bug" + ENV["GITHUB_REF_NAME"] = "main" + ENV["GITHUB_HEAD_REF"] = "fix/bug" ENV["GITHUB_SHA"] = "github-commit-sha" end diff --git a/src/coverage_reporter/ci/github.cr b/src/coverage_reporter/ci/github.cr index 10777e03..84b81f9d 100644 --- a/src/coverage_reporter/ci/github.cr +++ b/src/coverage_reporter/ci/github.cr @@ -17,7 +17,7 @@ module CoverageReporter repo_name: ENV["GITHUB_REPOSITORY"]?, service_number: ENV["GITHUB_RUN_ID"]?, service_job_id: ENV["GITHUB_JOB"]?, - service_branch: ENV["GITHUB_REF_NAME"]?, + service_branch: ENV["GITHUB_HEAD_REF"]? || ENV["GITHUB_REF_NAME"]?, service_build_url: build_url, commit_sha: ENV["GITHUB_SHA"]?, ).to_h