Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release: too many authors in authors section #26949

Closed
1 of 4 tasks
de-don opened this issue Jul 16, 2024 · 3 comments · Fixed by #27181
Closed
1 of 4 tasks

release: too many authors in authors section #26949

de-don opened this issue Jul 16, 2024 · 3 comments · Fixed by #27181

Comments

@de-don
Copy link

de-don commented Jul 16, 2024

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.

## 1.1.2 (2024-05-31)


### 🩹 Fixes

- example fix to check the build


### ❤️  Thank You

- Denis (Me)
- Other user 1
- Other user 2
- Other user 3
- Other user 4

Expected Behavior

Only authors of specific commits that described in changelog should be in authors

## 1.1.2 (2024-05-31)


### 🩹 Fixes

- example fix to check the build


### ❤️  Thank You

- Denis (Me)

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 all changes but for changelog it uses relevantChanges

Nx Report

NX   Report complete - copy this into the issue template

Node   : 18.18.2
OS     : darwin-arm64
npm    : 9.8.1

nx                 : 19.4.3
@nx/js             : 19.4.3
@nx/jest           : 19.4.3
@nx/linter         : 19.4.3
@nx/eslint         : 19.4.3
@nx/workspace      : 19.4.3
@nx/angular        : 19.4.3
@nx/cypress        : 19.4.3
@nx/devkit         : 19.4.3
@nx/eslint-plugin  : 19.4.3
@nx/playwright     : 19.4.3
@nx/plugin         : 19.4.3
@nx/storybook      : 19.4.3
@nrwl/tao          : 19.4.3
@nx/web            : 19.4.3
@nx/webpack        : 19.4.3
nx-cloud           : 19.0.0
typescript         : 5.1.6
---------------------------------------
Registered Plugins:
@mono/executors
@nx/playwright/plugin
---------------------------------------
Community plugins:
@front/angular-builder : 16.2.0
@storybook/angular     : 7.6.20
nx-stylelint           : 17.1.5

Failure Logs

No response

Package Manager Version

9.8.1

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

No response

@tinesoft
Copy link
Contributor

tinesoft commented Jul 19, 2024

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

const relevantChanges = changes.filter(
) but those filtered changes are not used when generating the authors section... (here :
for (const change of changes) {
)

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

@JamesHenry
Copy link
Collaborator

Thanks folks, this will be addressed by #27181

tinesoft added a commit to tinesoft/nxrocks that referenced this issue Aug 7, 2024
tinesoft added a commit to tinesoft/nxrocks that referenced this issue Aug 7, 2024
tinesoft added a commit to tinesoft/nxrocks that referenced this issue Aug 7, 2024
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants