Skip to content

feat: add --allow-no-commit to changelog command#1868

Merged
bearomorphism merged 4 commits intomasterfrom
fix-1866
May 3, 2026
Merged

feat: add --allow-no-commit to changelog command#1868
bearomorphism merged 4 commits intomasterfrom
fix-1866

Conversation

@bearomorphism
Copy link
Copy Markdown
Collaborator

@bearomorphism bearomorphism commented Feb 12, 2026

… but changelog command raised NoCommitsFoundError

Fixes #1866

Description

Checklist

Was generative AI tooling used to co-author this PR?

  • Yes (please specify the tool below)

Code Changes

  • Add test cases to all the changes you introduce
  • Run uv run poe all locally to ensure this change passes linter check and tests
  • Manually test the changes:
    • Verify the feature/bug fix works as expected in real-world scenarios
    • Test edge cases and error conditions
    • Ensure backward compatibility is maintained
    • Document any manual testing steps performed
  • Update the documentation for the changes

Documentation Changes

  • Run uv run poe doc locally to ensure the documentation pages renders correctly
  • Check and fix any broken links (internal or external)

Expected Behavior

Steps to Test This Pull Request

Additional Context

@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.99%. Comparing base (dd972c9) to head (72403ad).
⚠️ Report is 62 commits behind head on master.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1868   +/-   ##
=======================================
  Coverage   97.98%   97.99%           
=======================================
  Files          60       60           
  Lines        2686     2693    +7     
=======================================
+ Hits         2632     2639    +7     
  Misses         54       54           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment thread commitizen/commands/bump.py Outdated
… but changelog command raised NoCommitsFoundError
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes cz bump --allow-no-commit failures when update_changelog_on_bump = true and there are no commits between bumps (Issue #1866), by ensuring changelog generation doesn’t raise NoCommitsFoundError in that scenario.

Changes:

  • Adds an allow_no_commit flag to the internal Changelog command arguments and uses it to skip the “No commits found” error.
  • Passes allow_no_commit from the bump command into the changelog command invocation.
  • Adds a regression test covering bumping prereleases with --allow-no-commit while updating the changelog.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
commitizen/commands/changelog.py Accepts/stores allow_no_commit and uses it to suppress NoCommitsFoundError when there are no commits.
commitizen/commands/bump.py Forwards allow_no_commit into changelog generation during bump.
tests/commands/test_bump_command.py Adds a regression test reproducing Issue #1866.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread commitizen/commands/changelog.py Outdated
Comment thread commitizen/commands/bump.py
Comment thread tests/commands/test_bump_command.py Outdated
Comment thread tests/commands/test_bump_command.py Outdated
Copy link
Copy Markdown
Member

@woile woile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also update the documentation explaining the behavior of changelog when allow_no_commit is True and what it does 🙏🏻

Like what is mention in the OP ticket #1866 could be a good idea:

alter the CHANGELOG to indicate there has been a release but nothing has changed

Comment thread commitizen/commands/changelog.py Outdated
Comment thread tests/commands/test_bump_command.py Outdated
Align internal typing/forwarding for allow_no_commit, simplify the regression test setup, and document how changelog entries are generated during no-commit bumps.

Made-with: Cursor
@bearomorphism
Copy link
Copy Markdown
Collaborator Author

[AI-generated comment]\n\nAddressed the latest review feedback in 7d59bf4:\n- clarified internal typing/intent for allow_no_commit in changelog\n- normalized forwarded allow_no_commit to bool in bump\n- simplified the regression test setup\n- added docs for changelog behavior when --allow-no-commit is used with bump-triggered changelog generation\n\nValidated with:\nuv run pytest tests/commands/test_bump_command.py -k "allow_no_commit_issue or allow_no_commit_with_no_commit" -q\n(2 passed)

@bearomorphism
Copy link
Copy Markdown
Collaborator Author

Let me draft this PR... I think I need to fix it manually

@bearomorphism bearomorphism marked this pull request as draft April 15, 2026 15:23
bearomorphism and others added 2 commits April 16, 2026 00:03
Document that allow_no_commit in ChangelogArgs is internal-only for bump-triggered changelog generation.

Made-with: Cursor
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@bearomorphism bearomorphism marked this pull request as ready for review April 15, 2026 17:01
@woile
Copy link
Copy Markdown
Member

woile commented Apr 16, 2026

I agree, I think we should allow the new flag in cz changelog. This would mean it's a new feature.

Copy link
Copy Markdown
Member

@Lee-W Lee-W left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall looks good, also looks like a feature to me

@bearomorphism bearomorphism changed the title fix: bump command called changelog command with allow_no_commit=True,… feat: bump command called changelog command with allow_no_commit=True,… May 3, 2026
@bearomorphism bearomorphism changed the title feat: bump command called changelog command with allow_no_commit=True,… feat: add --allow-no-commit to changelog command May 3, 2026
@bearomorphism bearomorphism merged commit 72a2638 into master May 3, 2026
20 checks passed
@bearomorphism bearomorphism deleted the fix-1866 branch May 3, 2026 05:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Using --allow-no-commit on bump doesn't work (when updating CHANGELOG)

4 participants