Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OCPBUGS-23616: changelog script - parse arguments as time #882

Merged
merged 1 commit into from
Dec 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions cmd/changelog/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"sort"
"strconv"
"strings"
"time"
)

// norevive
Expand Down Expand Up @@ -100,8 +101,14 @@ func main() {
var releaseBlocks map[ReleaseVersion]MarkdownReleaseBlock
if len(os.Args) == 3 {
releaseBlocks = make(map[ReleaseVersion]MarkdownReleaseBlock)
after := os.Args[1]
until := os.Args[2]
after, err := time.Parse(time.DateOnly, os.Args[1])
if err != nil {
log.Fatalf("Failed to parse time arguments: %v", err)
}
until, err := time.Parse(time.DateOnly, os.Args[2])
if err != nil {
log.Fatalf("Failed to parse time arguments: %v", err)
}
gitLog = timeFrameReverseGitLog(after, until)
} else {
releaseBlocks = readCHANGELOG()
Expand Down Expand Up @@ -336,7 +343,7 @@ func findEarliestRelease(releases ReleaseVersions) ReleaseVersion {
return releases[0]
}

func timeFrameReverseGitLog(after, until string) []string {
func timeFrameReverseGitLog(after, until time.Time) []string {
// nolint: gosec
out, err := exec.Command(
"git",
Expand Down