Skip to content

Commit

Permalink
Include PRs that use tide squashing
Browse files Browse the repository at this point in the history
  • Loading branch information
g-gaston committed Dec 5, 2023
1 parent e4d85c9 commit 3bc3415
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
1 change: 0 additions & 1 deletion hack/tools/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ require (
cloud.google.com/go/compute v1.23.3 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
cloud.google.com/go/iam v1.1.5 // indirect
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
github.com/MakeNowJust/heredoc v1.0.0 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.2.0 // indirect
Expand Down
14 changes: 11 additions & 3 deletions hack/tools/release/notes/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,16 +119,24 @@ func (l *githubFromToPRLister) listPRs() ([]pr, error) {
return prs, nil
}

var mergeCommitMessage = regexp.MustCompile(`(?m)^Merge pull request #(\d+) .*$`)
var (
mergeCommitMessage = regexp.MustCompile(`(?m)^Merge pull request #(\d+) .*$`)
tideSquashedCommitMessage = regexp.MustCompile(`(?m)^.+\(#(?P<number>\d+)\)$`)
)

func buildSetOfPRNumbers(commits []githubCommitNode) map[string]struct{} {
prNumbers := make(map[string]struct{})
for _, commit := range commits {
match := mergeCommitMessage.FindStringSubmatch(commit.Commit.Message)
if len(match) != 2 {
if len(match) == 2 {
prNumbers[match[1]] = struct{}{}
continue
}
prNumbers[match[1]] = struct{}{}

match = tideSquashedCommitMessage.FindStringSubmatch(commit.Commit.Message)
if len(match) == 2 {
prNumbers[match[1]] = struct{}{}
}
}

return prNumbers
Expand Down

0 comments on commit 3bc3415

Please sign in to comment.