Skip to content

Commit 88abd0d

Browse files
authored
fix(librarian): generate PR body (#2009)
Fixes an issue where the generate PR body parsing code was referencing the wrong repo. Tested: codyoss/google-cloud-go#4 Fixes: #1972
1 parent 0df6d65 commit 88abd0d

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

internal/librarian/command.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ type commitInfo struct {
5555
cfg *config.Config
5656
state *config.LibrarianState
5757
repo gitrepo.Repository
58+
sourceRepo gitrepo.Repository
5859
ghClient GitHubClient
5960
idToCommits map[string]string
6061
failedLibraries []string
@@ -405,7 +406,7 @@ func addLabelsToPullRequest(ctx context.Context, ghClient GitHubClient, pullRequ
405406
func createPRBody(info *commitInfo) (string, error) {
406407
switch info.prType {
407408
case generate:
408-
return formatGenerationPRBody(info.repo, info.state, info.idToCommits, info.failedLibraries)
409+
return formatGenerationPRBody(info.sourceRepo, info.state, info.idToCommits, info.failedLibraries)
409410
case release:
410411
return formatReleaseNotes(info.repo, info.state)
411412
default:

internal/librarian/generate.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ func (r *generateRunner) run(ctx context.Context) error {
200200
cfg: r.cfg,
201201
state: r.state,
202202
repo: r.repo,
203+
sourceRepo: r.sourceRepo,
203204
ghClient: r.ghClient,
204205
idToCommits: idToCommits,
205206
failedLibraries: failedLibraries,

internal/librarian/release_init.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ func init() {
8787
type initRunner struct {
8888
cfg *config.Config
8989
repo gitrepo.Repository
90+
sourceRepo gitrepo.Repository
9091
state *config.LibrarianState
9192
librarianConfig *config.LibrarianConfig
9293
ghClient GitHubClient
@@ -104,6 +105,7 @@ func newInitRunner(cfg *config.Config) (*initRunner, error) {
104105
return &initRunner{
105106
cfg: runner.cfg,
106107
repo: runner.repo,
108+
sourceRepo: runner.sourceRepo,
107109
state: runner.state,
108110
librarianConfig: runner.librarianConfig,
109111
ghClient: runner.ghClient,
@@ -128,6 +130,7 @@ func (r *initRunner) run(ctx context.Context) error {
128130
cfg: r.cfg,
129131
state: r.state,
130132
repo: r.repo,
133+
sourceRepo: r.sourceRepo,
131134
ghClient: r.ghClient,
132135
commitMessage: "chore: create a release",
133136
prType: release,

0 commit comments

Comments
 (0)