From bfe8d0d16ff321cb37a15ce3fad8487fded3ce52 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 532efa06894c..d5e09c6f0e9d 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 were merged into main.\n\n", commitRange, len(commits)) + fmt.Printf("Changes from %v a total of %d new commits were merged into %s.\n\n", commitRange, len(commits), branch) for _, key := range outputOrder { mergeslice := merges[key]