Fix branch name when building main branch on GH (#4193)

Co-authored-by: MD <1917406+mdcfe@users.noreply.github.com>

Fixes #4191.
This commit is contained in:
Josh Roy 2021-06-03 12:03:14 -04:00 committed by GitHub
parent fbb3a9a0a4
commit 347751a826
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -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()) {