Skip to content

Commit

Permalink
Merge pull request #313 from metal3-cherrypick-bot/cherry-pick-310-to…
Browse files Browse the repository at this point in the history
…-release-1.3

📖 improve release notes tool
  • Loading branch information
metal3-io-bot authored Sep 5, 2023
2 parents 011e855 + a6da90c commit 930a41a
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions hack/tools/release/notes.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
//go:build tools
// +build tools

/*
Copyright 2019 The Kubernetes Authors.
Copyright 2021 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -41,6 +42,7 @@ const (
warning = ":warning: Breaking Changes"
other = ":seedling: Others"
unknown = ":question: Sort these by hand"
superseded = ":recycle: Superseded or Reverted"
)

var (
Expand All @@ -51,6 +53,7 @@ var (
documentation,
other,
unknown,
superseded,
}

fromTag = flag.String("from", "", "The tag or commit to start from.")
Expand Down Expand Up @@ -92,8 +95,8 @@ func firstCommit() string {
}

func run() int {
latestTag := latestTag()
lastTag := lastTag()
latestTag := latestTag()
cmd := exec.Command("git", "rev-list", lastTag+"..HEAD", "--merges", "--pretty=format:%B")

merges := map[string][]string{
Expand All @@ -103,6 +106,7 @@ func run() int {
warning: {},
other: {},
unknown: {},
superseded: {},
}
out, err := cmd.CombinedOutput()
if err != nil {
Expand Down Expand Up @@ -170,6 +174,9 @@ func run() int {
merges[key] = append(merges[key], formatMerge(body, prNumber))
}

// Add empty superseded section
merges[superseded] = append(merges[superseded], "- `<insert superseded bumps and reverts here>`")

// TODO Turn this into a link (requires knowing the project name + organization)
fmt.Printf("Changes since %v\n---\n", lastTag)

Expand All @@ -184,9 +191,8 @@ func run() int {
}
}

fmt.Printf("The image for this release is: %v\n", latestTag)
fmt.Println("")
fmt.Println("_Thanks to all our contributors!_ 😊")
fmt.Printf("The container image for this release is: %v\n", latestTag)
fmt.Println("\nThanks to all our contributors! 😊")

return 0
}
Expand Down

0 comments on commit 930a41a

Please sign in to comment.