diff --git a/build.gradle b/build.gradle index 48c27f223..a072a054b 100644 --- a/build.gradle +++ b/build.gradle @@ -46,8 +46,10 @@ def commitsSinceLastTag() { @SuppressWarnings('GrMethodMayBeStatic') def headBranchName() { - if (System.getenv("GITHUB_HEAD_REF") != null) { + if (System.getenv("GITHUB_HEAD_REF") != null && !System.getenv("GITHUB_HEAD_REF").isEmpty()) { return System.getenv("GITHUB_HEAD_REF") + } else if (System.getenv("GITHUB_REF") != null && !System.getenv("GITHUB_REF").isEmpty()) { + return System.getenv("GITHUB_REF").replaceFirst("refs/heads/", "") } if (!indraGit.isPresent()) {