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.");