Skip to content

Commit 86f3dd9

Browse files
authored
feat: add pull request owner to release note (#25)
1 parent 4010710 commit 86f3dd9

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

release.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ type ReleaseCommit struct {
143143
ReleaseNote string `json:"releaseNote,omitempty"`
144144
CategoryName string `json:"categoryName,omitempty"`
145145
PullRequestNumber int `json:"pullRequestNumber,omitempty"`
146+
PullRequestOwner string `json:"pullRequestOwner,omitempty"`
146147
}
147148

148149
func buildReleaseProposal(ctx context.Context, ghClient *githubClient, releaseFile string, gitExecPath, repoDir string, event *githubEvent) (*ReleaseProposal, error) {
@@ -286,6 +287,7 @@ func buildReleaseCommits(ctx context.Context, ghClient *githubClient, commits []
286287
if err != nil {
287288
return nil, err
288289
}
290+
c.PullRequestOwner = pr.GetUser().GetLogin()
289291
c.ReleaseNote = extractReleaseNote(pr.GetTitle(), pr.GetBody(), gen.UseReleaseNoteBlock)
290292
}
291293

@@ -330,6 +332,9 @@ func renderReleaseNote(p ReleaseProposal, cfg ReleaseConfig) []byte {
330332
b.WriteString(fmt.Sprintf("* %s", c.ReleaseNote))
331333
if gen.UsePullRequestMetadata && c.PullRequestNumber != 0 {
332334
b.WriteString(fmt.Sprintf(" ([#%d](https://github.com/%s/%s/pull/%d))", c.PullRequestNumber, p.Owner, p.Repo, c.PullRequestNumber))
335+
if !gen.UseReleaseNoteBlock && c.PullRequestOwner != "" {
336+
b.WriteString(fmt.Sprintf(" - by @%s", c.PullRequestOwner))
337+
}
333338
b.WriteString("\n")
334339
return
335340
}

0 commit comments

Comments
 (0)