Closed de-don closed 1 month ago
Hi,
I was having the same issue, after debugging locally, I found out the culprit:
In the defaultChangelogRenderer
Nx does filter relevant changes to consider for the project changelog (see at https://github.com/nrwl/nx/blob/b623104aac783e0591ef2381d697b87cdca655b6/packages/nx/release/changelog-renderer/index.ts#L200) but those filtered changes are not used when generating the authors section... (here :https://github.com/nrwl/nx/blob/b623104aac783e0591ef2381d697b87cdca655b6/packages/nx/release/changelog-renderer/index.ts#L282)
Here is a patch that solves the issue:
diff --git a/release/changelog-renderer/index.js b/release/changelog-renderer/index.js
index 5b2f41a880933f41856de81b11453c9b27efa733..f4bb0609a3c155fd0dcddfcb6393d888c06cd76c 100644
--- a/release/changelog-renderer/index.js
+++ b/release/changelog-renderer/index.js
@@ -25,10 +25,13 @@ const defaultChangelogRenderer = async ({ projectGraph, changes, releaseVersion,
}
}
}
+
+ let relevantChanges = [];
// workspace root level changelog
if (project === null) {
+ relevantChanges = changes;
// No changes for the workspace
- if (changes.length === 0) {
+ if (relevantChanges.length === 0) {
if (dependencyBumps?.length) {
applyAdditionalDependencyBumps({
markdownLines,
@@ -42,7 +45,7 @@ const defaultChangelogRenderer = async ({ projectGraph, changes, releaseVersion,
}
return markdownLines.join('\n').trim();
}
- const typeGroups = groupBy(changes, 'type');
+ const typeGroups = groupBy(relevantChanges, 'type');
markdownLines.push('', createVersionTitle(releaseVersion, changelogRenderOptions), '');
for (const type of Object.keys(changeTypes)) {
const group = typeGroups[type];
@@ -75,7 +78,7 @@ const defaultChangelogRenderer = async ({ projectGraph, changes, releaseVersion,
}
else {
// project level changelog
- const relevantChanges = changes.filter((c) => c.affectedProjects &&
+ relevantChanges = changes.filter((c) => c.affectedProjects &&
(c.affectedProjects === '*' || c.affectedProjects.includes(project)));
// Generating for a named project, but that project has no relevant changes in the current set of commits, exit early
if (relevantChanges.length === 0) {
@@ -128,7 +131,7 @@ const defaultChangelogRenderer = async ({ projectGraph, changes, releaseVersion,
}
if (changelogRenderOptions.authors) {
const _authors = new Map();
- for (const change of changes) {
+ for (const change of relevantChanges) {
if (!change.author) {
continue;
}
I will try to push a PR, once I manage to have my devcontainer setup working again
Thanks folks, this will be addressed by https://github.com/nrwl/nx/pull/27181
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.
Current Behavior
I did small change in one of my libraries, and trying to publish it with
nx release
, and it generates changelog with too many authors, not relevant to my changes. Sometimes it includes wierd commit sha.Expected Behavior
Only authors of specific commits that described in changelog should be in authors
GitHub Repo
No response
Steps to Reproduce
Don't know exactly how to reproduce, but I think the problem in
changelog-renderer
: when generating authors, it uses allchanges
but for changelog it usesrelevantChanges
Nx Report
Failure Logs
No response
Package Manager Version
9.8.1
Operating System
Additional Information
No response