From a4bd4f56376c4d26bfb5780f3de7f2d0e99853b9 Mon Sep 17 00:00:00 2001 From: chandankumar4 Date: Fri, 22 Dec 2023 22:31:15 +0530 Subject: [PATCH] Fix wrong branch name display for weekly update script Signed-off-by: chandankumar4 --- hack/tools/release/weekly/main.go | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/hack/tools/release/weekly/main.go b/hack/tools/release/weekly/main.go index bedbe2edc7bb..6f09b5dbbd01 100644 --- a/hack/tools/release/weekly/main.go +++ b/hack/tools/release/weekly/main.go @@ -169,9 +169,24 @@ func run() int { merges[key] = append(merges[key], formatMerge(body, prNumber)) } + // fetch the current branch + out, err = exec.Command("git", "rev-parse", "--abbrev-ref", "HEAD").CombinedOutput() + if err != nil { + fmt.Println("Error") + fmt.Println(err) + fmt.Println(string(out)) + return 1 + } + + branch := strings.TrimSpace(string(out)) + if branch == "" { + fmt.Println("Error: failed to get current branch!!!") + return 1 + } + // TODO Turn this into a link (requires knowing the project name + organization) fmt.Println("Weekly update :rotating_light:") - fmt.Printf("Changes from %v a total of %d new commits where merged into main.\n\n", commitRange, len(commits)) + fmt.Printf("Changes from %v a total of %d new commits where merged into %s.\n\n", commitRange, len(commits), branch) for _, key := range outputOrder { mergeslice := merges[key]