Skip to content

Commit 9d21e30

Browse files
authored
fix: add commit body to release note (#2316)
Release note example: googleapis/google-cloud-python#14531 Fixes #2234
1 parent 17a68d4 commit 9d21e30

File tree

2 files changed

+47
-11
lines changed

2 files changed

+47
-11
lines changed

internal/librarian/release_notes.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ Language Image: {{.ImageVersion}}
7676
### {{.Heading}}
7777
{{ range .Commits }}
7878
{{ if index .Footers "PiperOrigin-RevId" -}}
79-
* {{.Subject}} (PiperOrigin-RevId: {{index .Footers "PiperOrigin-RevId"}}) ([{{shortSHA .CommitHash}}]({{"https://github.com/"}}{{$noteSection.RepoOwner}}/{{$noteSection.RepoName}}/commit/{{.CommitHash}}))
79+
* {{.Subject}} {{.Body}} (PiperOrigin-RevId: {{index .Footers "PiperOrigin-RevId"}}) ([{{shortSHA .CommitHash}}]({{"https://github.com/"}}{{$noteSection.RepoOwner}}/{{$noteSection.RepoName}}/commit/{{.CommitHash}}))
8080
{{- else -}}
81-
* {{.Subject}} ([{{shortSHA .CommitHash}}]({{"https://github.com/"}}{{$noteSection.RepoOwner}}/{{$noteSection.RepoName}}/commit/{{.CommitHash}}))
81+
* {{.Subject}} {{.Body}} ([{{shortSHA .CommitHash}}]({{"https://github.com/"}}{{$noteSection.RepoOwner}}/{{$noteSection.RepoName}}/commit/{{.CommitHash}}))
8282
{{- end }}
8383
{{ end }}
8484

internal/librarian/release_notes_test.go

Lines changed: 45 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -529,11 +529,11 @@ Language Image: go:1.21
529529
530530
### Features
531531
532-
* new feature ([1234567](https://github.com/owner/repo/commit/1234567890abcdef000000000000000000000000))
532+
* new feature ([1234567](https://github.com/owner/repo/commit/1234567890abcdef000000000000000000000000))
533533
534534
### Bug Fixes
535535
536-
* a bug fix ([fedcba0](https://github.com/owner/repo/commit/fedcba0987654321000000000000000000000000))
536+
* a bug fix ([fedcba0](https://github.com/owner/repo/commit/fedcba0987654321000000000000000000000000))
537537
538538
</details>`,
539539
librarianVersion, today),
@@ -579,11 +579,11 @@ Language Image: go:1.21
579579
580580
### Features
581581
582-
* new feature (PiperOrigin-RevId: 123456) ([1234567](https://github.com/owner/repo/commit/1234567890abcdef000000000000000000000000))
582+
* new feature (PiperOrigin-RevId: 123456) ([1234567](https://github.com/owner/repo/commit/1234567890abcdef000000000000000000000000))
583583
584584
### Bug Fixes
585585
586-
* a bug fix (PiperOrigin-RevId: 987654) ([fedcba0](https://github.com/owner/repo/commit/fedcba0987654321000000000000000000000000))
586+
* a bug fix (PiperOrigin-RevId: 987654) ([fedcba0](https://github.com/owner/repo/commit/fedcba0987654321000000000000000000000000))
587587
588588
</details>`,
589589
librarianVersion, today),
@@ -623,9 +623,9 @@ Language Image: go:1.21
623623
624624
### Features
625625
626-
* new feature ([1234567](https://github.com/owner/repo/commit/1234567890abcdef000000000000000000000000))
626+
* new feature ([1234567](https://github.com/owner/repo/commit/1234567890abcdef000000000000000000000000))
627627
628-
* another new feature ([fedcba0](https://github.com/owner/repo/commit/fedcba0987654321000000000000000000000000))
628+
* another new feature ([fedcba0](https://github.com/owner/repo/commit/fedcba0987654321000000000000000000000000))
629629
630630
</details>`,
631631
librarianVersion, today),
@@ -674,7 +674,7 @@ Language Image: go:1.21
674674
675675
### Features
676676
677-
* feature for a ([1234567](https://github.com/owner/repo/commit/1234567890abcdef000000000000000000000000))
677+
* feature for a ([1234567](https://github.com/owner/repo/commit/1234567890abcdef000000000000000000000000))
678678
679679
</details>
680680
@@ -685,7 +685,7 @@ Language Image: go:1.21
685685
686686
### Bug Fixes
687687
688-
* fix for b ([fedcba0](https://github.com/owner/repo/commit/fedcba0987654321000000000000000000000000))
688+
* fix for b ([fedcba0](https://github.com/owner/repo/commit/fedcba0987654321000000000000000000000000))
689689
690690
</details>`,
691691
librarianVersion, today, today),
@@ -725,7 +725,43 @@ Language Image: go:1.21
725725
726726
### Features
727727
728-
* new feature ([1234567](https://github.com/owner/repo/commit/1234567890abcdef000000000000000000000000))
728+
* new feature ([1234567](https://github.com/owner/repo/commit/1234567890abcdef000000000000000000000000))
729+
730+
</details>`,
731+
librarianVersion, today),
732+
},
733+
{
734+
name: "release_with_commit_description_and_body",
735+
state: &config.LibrarianState{
736+
Image: "go:1.21",
737+
Libraries: []*config.LibraryState{
738+
{
739+
ID: "my-library",
740+
// this is the newVersion in the release note.
741+
Version: "1.1.0",
742+
PreviousVersion: "1.0.0",
743+
ReleaseTriggered: true,
744+
Changes: []*conventionalcommits.ConventionalCommit{
745+
{
746+
Type: "feat",
747+
Subject: "new feature",
748+
Body: "this is the body",
749+
CommitHash: hash1.String(),
750+
},
751+
},
752+
},
753+
},
754+
},
755+
ghRepo: &github.Repository{Owner: "owner", Name: "repo"},
756+
wantReleaseNote: fmt.Sprintf(`Librarian Version: %s
757+
Language Image: go:1.21
758+
<details><summary>my-library: 1.1.0</summary>
759+
760+
## [1.1.0](https://github.com/owner/repo/compare/my-library-1.0.0...my-library-1.1.0) (%s)
761+
762+
### Features
763+
764+
* new feature this is the body ([1234567](https://github.com/owner/repo/commit/1234567890abcdef000000000000000000000000))
729765
730766
</details>`,
731767
librarianVersion, today),

0 commit comments

Comments
 (0)