Title: feat: add changelog_skip_prereleases setting to omit prerelease entries from changelog by bearomorphism · Pull Request #1985 · commitizen-tools/commitizen · GitHub
Open Graph Title: feat: add changelog_skip_prereleases setting to omit prerelease entries from changelog by bearomorphism · Pull Request #1985 · commitizen-tools/commitizen
X Title: feat: add changelog_skip_prereleases setting to omit prerelease entries from changelog by bearomorphism · Pull Request #1985 · commitizen-tools/commitizen
Description: Description Adds a new changelog_skip_prereleases configuration setting (default alse). When enabled, all prerelease release entries (tags whose version parses as a prerelease - c, �lpha, �eta, dev, etc.) are omitted from the generated changelog entirely. Closes #1218 Why Currently, users who ship prereleases see cluttered changelogs like: ` 0.1.0-b0 (2024-08-20) 0.1.0-a0 (2024-08-20) Feat add onboarding modal 0.1.0 (2024-08-20) ` The only existing option (--merge-prerelease) collapses prereleases into the next stable entry. There is no way to drop them silently. This PR adds that opt-in. What changed File Change commitizen/defaults.py Added changelog_skip_prereleases: bool to Settings TypedDict and DEFAULT_SETTINGS (default alse) commitizen/tags.py Added skip_prereleases: bool field to TagRules; updated include_in_changelog so that prerelease tags return False when the flag is set; updated rom_settings factory commitizen/commands/changelog.py Passes skip_prereleases from config when constructing TagRules ests/test_conf.py Added changelog_skip_prereleases to both expected-settings literals (avoids CI failure) ests/test_changelog.py Two new unit tests for generate_tree_from_commits ests/commands/test_changelog_command.py Two new end-to-end tests via cz changelog --dry-run docs/commands/changelog.md New section next to --merge-prerelease How it works TagRules.include_in_changelog is the single gate that decides whether a tag produces a release block in the changelog tree. When skip_prereleases=True the method returns False for any tag whose parsed version satisfies �ersion.is_prerelease, before the merge-prerelease check runs. Backward compatibility Default is alse; no existing behaviour changes. When both changelog_skip_prereleases = true and changelog_merge_prerelease = true are set, skip wins (documented in the docs and asserted in a test). Checklist I have read the contributing guidelines Was generative AI tooling used to co-author this PR? Yes (please specify the tool below) Generated-by: Claude following the guidelines Code Changes Add test cases to all the changes you introduce Run linters and tests locally Manually test the changes Update the documentation for the changes Documentation Changes Added changelog_skip_prereleases section in docs/commands/changelog.md next to --merge-prerelease Expected Behavior Scenario Before After changelog_skip_prereleases = false (default) Prereleases appear in changelog Same - no change changelog_skip_prereleases = true N/A Prerelease entries ( c, �lpha, �eta, dev) omitted Both skip and merge set to rue merge wins skip wins (prereleases dropped, not collapsed) Steps to Test This Pull Request `�ash Clone and set up git clone https://github.com/bearomorphism/commitizen && cd commitizen git checkout fix/1218-changelog-skip-prereleases uv sync --frozen --group base --group test --group linters Run targeted tests uv run pytest tests/test_changelog.py::test_generate_tree_from_commits_skip_prereleases uv run pytest tests/test_changelog.py::test_skip_prereleases_wins_over_merge_prereleases uv run pytest tests/commands/test_changelog_command.py::test_changelog_config_flag_skip_prereleases uv run pytest tests/commands/test_changelog_command.py::test_changelog_config_skip_prereleases_wins_over_merge_prerelease ` Additional Context Related to #1965 (merge-prerelease) which was the original implementation of prerelease handling in changelogs.
Open Graph Description: Description Adds a new changelog_skip_prereleases configuration setting (default alse). When enabled, all prerelease release entries (tags whose version parses as a prerelease - c, �lpha, �eta, de...
X Description: Description Adds a new changelog_skip_prereleases configuration setting (default alse). When enabled, all prerelease release entries (tags whose version parses as a prerelease - c, �lpha, �eta, de...
Opengraph URL: https://github.com/commitizen-tools/commitizen/pull/1985
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:ee300ecc-f840-76fb-6a35-6f17997f70b9 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 963C:512E3:1E216A4:29EFFEB:6A4ECEF6 |
| html-safe-nonce | 7e20ecc219ac0d9144df821c0cdb922d9a0bd305790bb097124dece56c28cdfe |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NjNDOjUxMkUzOjFFMjE2QTQ6MjlFRkZFQjo2QTRFQ0VGNiIsInZpc2l0b3JfaWQiOiI4MzYxMzEzNDI4NzgyODk0ODM4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 650c03e2068c0b488f6ba906ad790941819a7907d1aee4d25def04c64735cdbd |
| hovercard-subject-tag | pull_request:3655055001 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/commitizen-tools/commitizen/pull/1985/files |
| twitter:image | https://avatars.githubusercontent.com/u/26526132?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/26526132?s=400&v=4 |
| og:image:alt | Description Adds a new changelog_skip_prereleases configuration setting (default alse). When enabled, all prerelease release entries (tags whose version parses as a prerelease - c, �lpha, �eta, de... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 41b6ab3ba6d20a71766ac245b5a4a94c6fc672a9cd4da7d44c1b33ab8bf6a21c |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/commitizen-tools/commitizen git https://github.com/commitizen-tools/commitizen.git |
| octolytics-dimension-user_id | 62252524 |
| octolytics-dimension-user_login | commitizen-tools |
| octolytics-dimension-repository_id | 106127589 |
| octolytics-dimension-repository_nwo | commitizen-tools/commitizen |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 106127589 |
| octolytics-dimension-repository_network_root_nwo | commitizen-tools/commitizen |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | e6a744804e8e70f97b4d5a18a94dcc63db22f97a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width