Skip to content

Changelog not generated if bump is skipped (also affects commit step) #868

Open
@fcastilloec

Description

@fcastilloec

Describe the bug
When skipping bump a changelog is not generated.

Current behavior
No changelog is generated.

Expected behavior
A changelog should be generated, either only on the command line (similar to --dry-run), on a different file, or on a different section in the changelog (i.e. Unreleased)

Environment

  • standard-version version(s): 9.3.2
  • Node/npm version: 16.10.0 / 8.3.0
  • OS: Ubuntu 20.04

Additional context
This is also related to #862 and it's all because of the version numbering. In my particular case, I also get an error if I'm not skipping commit. I get the error Command failed: git commit --no-verify -S CHANGELOG.md -m release: v1.0.1 and that's because CHANGELOG.md hasn't changed.
Creating a tag also produces an error because the version hasn't changed. This is not an easy fix, since we might have deleted the current tag just to recreate it, and no error is shown; this is a special case though.

Possible Solution
For the tag issues, perhaps creating an Unreleased tag might also be a good idea, or having checks inside the tag lifecycle for different scenarios. An easy fix would be to skip tag by default if bump is skipped.
Probably, just documenting what happens when you skip a step would be better. So people are aware of the ramifications and could better understand any errors/behavior. Haven said that skipping a bump should still be able to generate a changelog.

This possible solution, specific to the changelog, adds an Unreleased section. This actually makes changes to the file and avoids any errors when committing due to the changelog not having any changes. This new section could be configurable and, in my opinion, should always be overwritten.

index.js#L72-L73

const newVersion = await bump(args, version)
await changelog(args, newVersion === version ? 'Unreleased' : newVersion)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions