diff --git a/packages/melos/lib/src/common/changelog.dart b/packages/melos/lib/src/common/changelog.dart index e522b846..0a60242a 100644 --- a/packages/melos/lib/src/common/changelog.dart +++ b/packages/melos/lib/src/common/changelog.dart @@ -194,6 +194,16 @@ extension ChangelogStringBufferExtension on StringBuffer { } writeln(); + + if (update.workspace.config.commands.version.includeCommitBody && + parsedMessage.body != null) { + writeln(); + for (final line in parsedMessage.body!.split('\n')) { + write(' ' * 4); + writeln(line); + } + writeln(); + } } writeln(); } diff --git a/packages/melos/lib/src/workspace_configs.dart b/packages/melos/lib/src/workspace_configs.dart index 9c7b0afc..c60d3d96 100644 --- a/packages/melos/lib/src/workspace_configs.dart +++ b/packages/melos/lib/src/workspace_configs.dart @@ -606,6 +606,7 @@ class VersionCommandConfigs { this.includeScopes = true, this.linkToCommits = false, this.includeCommitId = false, + this.includeCommitBody = false, this.updateGitTagRefs = false, this.releaseUrl = false, List? aggregateChangelogs, @@ -726,11 +727,18 @@ class VersionCommandConfigs { ) : VersionLifecycleHooks.empty; + final inlcudeCommitBody = assertKeyIsA( + key: 'includeCommitBody', + map: yaml, + path: 'command/version', + ); + return VersionCommandConfigs( branch: branch, message: message, includeScopes: includeScopes ?? true, includeCommitId: includeCommitId ?? false, + includeCommitBody: inlcudeCommitBody ?? false, linkToCommits: linkToCommits ?? repositoryIsConfigured, updateGitTagRefs: updateGitTagRefs ?? false, releaseUrl: releaseUrl ?? false, @@ -756,6 +764,9 @@ class VersionCommandConfigs { /// Whether to add commits ids in the generated CHANGELOG.md. final bool includeCommitId; + /// Wheter to include commit bodies in the generated CHANGELOG.md. + final bool includeCommitBody; + /// Whether to add links to commits in the generated CHANGELOG.md. final bool linkToCommits;