From 29685bbe9153b4336bee830fe4e227821eddb86b Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Fri, 20 May 2022 19:59:26 +0200 Subject: [PATCH] internal/build: parse buildbot tag better --- internal/build/env.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/internal/build/env.go b/internal/build/env.go index c0cc9437da..8c050c3f82 100644 --- a/internal/build/env.go +++ b/internal/build/env.go @@ -97,11 +97,10 @@ func Env() Environment { // we can distinguish them by the git refspec. var branch, tag string branchSpec := os.Getenv("BUILD_BRANCH") - switch { - case strings.HasPrefix(branchSpec, "refs/heads/"): - branch = strings.TrimPrefix(branchSpec, "refs/heads/") - case strings.HasPrefix(branchSpec, "refs/tags/"): + if strings.HasPrefix(branchSpec, "refs/tags/") { tag = strings.TrimPrefix(branchSpec, "refs/tags/") + } else { + branch = branchSpec } commit := os.Getenv("BUILD_COMMIT")