Skip to content

Locally generated changelog isn't including the diff link in version headings #244

@kleinfreund

Description

@kleinfreund

Describe the bug

When running npx commit-and-tag-version locally, I find that changelog generation works differently from the exact same command execution in CI.

Specifically, the version headings don't include the diff link when running locally. As a result, the command duplicates the entire changelog and adds the new entry to the top.

Notably, the content under each version heading is the same as before including the commit hash links in parentheses so it's only the headings that are different.

npx commit-and-tag-version --release-as patch:

✔ bumping version in package.json from 16.0.0 to 16.0.1
✔ bumping version in package-lock.json from 16.0.0 to 16.0.1
✔ outputting changes to CHANGELOG.md
✔ committing package-lock.json and package.json and CHANGELOG.md
✔ tagging release 16.0.1
ℹ Run `git push --follow-tags origin main && npm publish` to publish

Current behavior

Version headings don't include links to the diff view in GitHub.

## 16.0.1 (2025-08-05)

Expected behavior

Version headings do include links to the diff view in GitHub.

## [16.0.1](https://github.com/ORG/REPO/compare/v16.0.0...v16.0.1) (2025-08-05)

Environment

  • commit-and-tag-version version(s): 12.5.2
  • Node/npm version: v23.11.1/11.5.2
  • OS: macOS 15.6

Possible Solution

I reckon the version headings being different causes the duplication of virtually the entire changelog because some internal logic checks the diff between old and new changelog (this is conjecture; I haven't looked at the source code).

Additional context

  • The last time a version in my software was published was on commit-and-tag-version using version 12.5.1 on 2025-07-23 via CI workflow and it generated the changelog as expected. This indicates that this is not a regression since 12.5.1 as 12.5.2 contains only one change that is certainly unrelated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions