feat: add --allow-no-commit to changelog command#1868
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 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. |
83e11ab to
a1d944c
Compare
… but changelog command raised NoCommitsFoundError
a1d944c to
0598e36
Compare
There was a problem hiding this comment.
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_commitflag to the internalChangelogcommand arguments and uses it to skip the “No commits found” error. - Passes
allow_no_commitfrom thebumpcommand into thechangelogcommand invocation. - Adds a regression test covering bumping prereleases with
--allow-no-commitwhile 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.
woile
left a comment
There was a problem hiding this comment.
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
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
|
[AI-generated comment]\n\nAddressed the latest review feedback in 7d59bf4:\n- clarified internal typing/intent for |
|
Let me draft this PR... I think I need to fix it manually |
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>
|
I agree, I think we should allow the new flag in |
Lee-W
left a comment
There was a problem hiding this comment.
overall looks good, also looks like a feature to me
--allow-no-commit to changelog command
… but changelog command raised NoCommitsFoundError
Fixes #1866
Description
Checklist
Was generative AI tooling used to co-author this PR?
Code Changes
uv run poe alllocally to ensure this change passes linter check and testsDocumentation Changes
uv run poe doclocally to ensure the documentation pages renders correctlyExpected Behavior
Steps to Test This Pull Request
Additional Context