Skip to content

Commit ffc7629

Browse files
committed
compare with correct tag
Signed-off-by: Kenneth Bingham <[email protected]>
1 parent 0732e68 commit ffc7629

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

pkg/github/github.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424

2525
"github.com/Songmu/retry"
2626
"github.com/pkg/errors"
27+
"helm.sh/helm/v3/pkg/chart"
2728

2829
"github.com/blang/semver"
2930
"github.com/google/go-github/v56/github"
@@ -151,9 +152,9 @@ func (c *Client) GetLatestChartRelease(_ context.Context, prefix string) (*Relea
151152
}
152153

153154
// GenerateReleaseNotes generates the release notes for a release
154-
func (c *Client) GenerateReleaseNotes(_ context.Context, latestRelease *Release, nextRelease string) (string, error) {
155+
func (c *Client) GenerateReleaseNotes(_ context.Context, latestRelease *Release, chart *chart.Chart) (string, error) {
155156
notes, _, err := c.Repositories.GenerateReleaseNotes(context.TODO(), c.owner, c.repo, &github.GenerateNotesOptions{
156-
TagName: nextRelease,
157+
TagName: chart.Metadata.Name + "-" + chart.Metadata.Version,
157158
PreviousTagName: &latestRelease.Name,
158159
})
159160
if err != nil {

pkg/releaser/releaser.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ type GitHub interface {
5252
GetRelease(ctx context.Context, tag string) (*github.Release, error)
5353
CreatePullRequest(owner string, repo string, message string, head string, base string) (string, error)
5454
GetLatestChartRelease(ctx context.Context, prefix string) (*github.Release, error)
55-
GenerateReleaseNotes(ctx context.Context, latestRelease *github.Release, nextRelease string) (string, error)
55+
GenerateReleaseNotes(ctx context.Context, latestRelease *github.Release, chart *chart.Chart) (string, error)
5656
}
5757

5858
type Git interface {
@@ -260,7 +260,7 @@ func (r *Releaser) getReleaseNotes(chart *chart.Chart) (string, error) {
260260
highest := versions[len(versions)-1]
261261
// skip generating notes if there's already a higher version in GitHub
262262
if nextVersion.String() == highest.String() {
263-
notes, err := r.github.GenerateReleaseNotes(context.TODO(), latestRelease, chart.Metadata.Version)
263+
notes, err := r.github.GenerateReleaseNotes(context.TODO(), latestRelease, chart)
264264
if err != nil {
265265
return "", errors.Wrapf(err, "failed to generate release notes for chart %s", chart.Metadata.Name)
266266
}

pkg/releaser/releaser_test.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import (
2929
"helm.sh/helm/v3/pkg/repo"
3030

3131
"github.com/helm/chart-releaser/pkg/config"
32+
"helm.sh/helm/v3/pkg/chart"
3233
)
3334

3435
type FakeGitHub struct {
@@ -133,8 +134,8 @@ func (f *FakeGitHub) GetLatestChartRelease(_ context.Context, prefix string) (*g
133134
}
134135

135136
// GenerateReleaseNotes generates the release notes for a release
136-
func (f *FakeGitHub) GenerateReleaseNotes(_ context.Context, latestRelease *github.Release, nextRelease string) (string, error) {
137-
f.Called(latestRelease, nextRelease)
137+
func (f *FakeGitHub) GenerateReleaseNotes(_ context.Context, latestRelease *github.Release, chart *chart.Chart) (string, error) {
138+
f.Called(latestRelease, chart)
138139

139140
notes := "# Noted."
140141

0 commit comments

Comments
 (0)