Skip to content

feat(context): expose determined bump type in release context#1483

Open
ChihebBENCHEIKH1 wants to merge 1 commit intoorhun:mainfrom
ChihebBENCHEIKH1:feat/add-bump-type-to-context
Open

feat(context): expose determined bump type in release context#1483
ChihebBENCHEIKH1 wants to merge 1 commit intoorhun:mainfrom
ChihebBENCHEIKH1:feat/add-bump-type-to-context

Conversation

@ChihebBENCHEIKH1
Copy link
Copy Markdown

Closes #1220

Adds a bump_type field to the Release struct, exposing the determined version bump type in both templates and the JSON context output (-x).

Values: "major", "minor", "patch", or null

Usage in templates:
{% if bump_type == "major" %}Breaking release{% endif %}

In JSON context (--context):
{"version": "1.2.0", "bump_type": "minor", ...}

How it works:

  • When bump_type is forced via config, uses that directly
  • Otherwise, compares the previous and next semver versions to determine the type
  • Returns null when no previous version exists (initial tag)

Changes:

  • Added bump_type: Option<BumpType> to Release struct
  • Modified calculate_next_version_with_config to return the determined bump type
  • Updated bump_version() to populate the field
  • Added bump_version_type test covering auto-detection, forced config, and initial tag cases

@ChihebBENCHEIKH1 ChihebBENCHEIKH1 requested a review from orhun as a code owner April 17, 2026 11:02
@ChihebBENCHEIKH1 ChihebBENCHEIKH1 force-pushed the feat/add-bump-type-to-context branch 2 times, most recently from 8ee147e to 57ee25b Compare April 17, 2026 11:05
…1220)

Add `bump_type` field to the `Release` struct so that templates
can reference `{{ bump_type }}` and the JSON context (`-x`) includes
the determined version bump type ("major", "minor", "patch", or null).

The bump type is derived by comparing the previous and next semver
versions, or taken directly from the forced `bump_type` config when set.
@ChihebBENCHEIKH1 ChihebBENCHEIKH1 force-pushed the feat/add-bump-type-to-context branch from 57ee25b to 4e6abc8 Compare April 17, 2026 11:11
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 47.83%. Comparing base (ee8bfd1) to head (4e6abc8).

Files with missing lines Patch % Lines
git-cliff-core/src/release.rs 91.31% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1483      +/-   ##
==========================================
+ Coverage   47.40%   47.83%   +0.44%     
==========================================
  Files          24       24              
  Lines        2129     2141      +12     
==========================================
+ Hits         1009     1024      +15     
+ Misses       1120     1117       -3     
Flag Coverage Δ
unit-tests 47.83% <92.00%> (+0.44%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ChihebBENCHEIKH1
Copy link
Copy Markdown
Author

Nope, all done! The force pushes were just formatting fixes. CI is green now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add determined version bump type inside git-cliff context

2 participants