From 6575a4ef4cac85a47936d2ae69d29f8c3a79f344 Mon Sep 17 00:00:00 2001 From: priyasomangali <46961539+priyasomangali@users.noreply.github.com> Date: Wed, 23 Aug 2023 12:25:44 +0800 Subject: [PATCH] fix branch name on CI (#41) Co-authored-by: psomangali --- src/Agoda.DevFeedback.Common/GitContextReader.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Agoda.DevFeedback.Common/GitContextReader.cs b/src/Agoda.DevFeedback.Common/GitContextReader.cs index 0e71b64..32b0703 100644 --- a/src/Agoda.DevFeedback.Common/GitContextReader.cs +++ b/src/Agoda.DevFeedback.Common/GitContextReader.cs @@ -9,8 +9,8 @@ public static class GitContextReader public static GitContext GetGitContext() { string url = RunCommand("config --get remote.origin.url"); - string branch = RunCommand("rev-parse --abbrev-ref HEAD"); - + string branch = Environment.GetEnvironmentVariable("CI_COMMIT_REF_NAME") ?? RunCommand("rev-parse --abbrev-ref HEAD"); + if (string.IsNullOrEmpty(url)) { throw new GitContextException("Unable to get git remote url.");