Skip to content

nx release: per-group changelog files not staged into release commit when using --groups with fixed projectsRelationship #35559

@edward-montoya-endava-gbg

Description

Current Behavior

When running the top-level nx release command with --groups=… (no --projects= flag) on a config that uses fixed release groups with a per-group changelog.file, the generated changelog files are written to disk but not staged into the release commit. Only the package.json updates from the version phase end up in the release commit; the CHANGELOG.md files for each affected group remain dirty in the working tree and are discarded when CI tears down.

The log shows two related symptoms:

  1. Per-project iteration inside fixed groups. For a fixed group with N projects sharing one changelog.file, the log emits N Generating an entry in <file> for <group>@v<version> lines. The first iteration writes; subsequent iterations log NOTE: There was no diff detected for the changelog entry.

  2. Final summary incorrectly reports no changes. After several files have been UPDATEd / CREATEd in the per-group iteration, the run still prints:

    NX   No changes detected for changelogs
    
    No changes were detected for any changelog files, so no changelog entries will be generated.
    

    The release commit then contains only the version-phase package.json writes; the changelog files never make it into the index.

Expected Behavior

When nx release writes one or more per-group changelog/<group>/CHANGELOG.md files during the changelog phase, those files should be staged into the same release commit as the package.json version bumps.

Steps to Reproduce

  1. Initialize an Nx workspace with two libraries that match a wildcard, e.g. domain-feature-a and providers-feature-a.

  2. Configure a fixed release group sharing a per-group changelog file. Minimal nx.json:

    {
      "release": {
        "git": { "commitMessage": "chore: updated version [no ci]" },
        "version": { "conventionalCommits": true },
        "changelog": {
          "workspaceChangelog": false,
          "projectChangelogs": true
        },
        "groups": {
          "feature-a": {
            "projects": ["*-feature-a"],
            "projectsRelationship": "fixed",
            "releaseTag": { "pattern": "feature-a@v{version}" },
            "changelog": {
              "file": "changelog/feature-a/CHANGELOG.md",
              "createRelease": "github"
            },
            "version": { "conventionalCommits": true }
          }
        }
      }
    }
  3. Tag a starting version: git tag feature-a@v1.0.0.

  4. Add a conventional commit that affects one of the projects in the group:

    fix(feature-a): trigger a patch bump
    
  5. Run the top-level release command (no --projects=):

    nx release --groups=feature-a --skip-publish
    
  6. Inspect the resulting release commit:

    git show HEAD --stat
    

Observed:

  • The console log shows UPDATE changelog/feature-a/CHANGELOG.md once (with the new entry diff), then a second Generating an entry in changelog/feature-a/CHANGELOG.md for feature-a@v1.0.1 followed by NOTE: There was no diff detected for the changelog entry.
  • The final summary prints [NX] No changes detected for changelogs / No changelog entries will be generated.
  • git show HEAD --stat lists only the two package.json files. changelog/feature-a/CHANGELOG.md is dirty in the working tree but not in the commit.

Nx Report

(output of `nx report` from the affected workspace)

Node             : 20.x
OS               : linux x64
Native Target    : x86_64-linux
nx               : 22.5.2
@nx/js           : 22.5.2
@nx/workspace    : 22.5.2

Failure Logs

NX   Staging changed files with git              # version phase only — package.json files

NX   Generating an entry in changelog/feature-a/CHANGELOG.md for feature-a@v1.0.1
UPDATE changelog/feature-a/CHANGELOG.md
+ ## 1.0.1 (...)
+
+ ### 🩹 Fixes
+
+ - **feature-a:** trigger a patch bump

NX   Generating an entry in changelog/feature-a/CHANGELOG.md for feature-a@v1.0.1
NOTE: There was no diff detected for the changelog entry. Maybe you intended to pass alternative git references via --from and --to?

NX   No changes detected for changelogs

No changes were detected for any changelog files, so no changelog entries will be generated.

NX   Committing changes with git
NX   Tagging commit with git
NX   Pushing to git remote "origin"

Resulting commit:

$ git show HEAD --stat
chore: updated version [no ci]

 packages/domain-feature-a/package.json    | 2 +-
 packages/providers-feature-a/package.json | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

Package Manager Version

bun 1.3.10 (also reproduced with npm; not package-manager-specific.)

Operating System

  • macOS
  • Linux
  • Windows
  • Other

Additional Information

Related prior reports:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions