Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(changelog)!: support templating in the footer #369

Merged
merged 2 commits into from
Dec 5, 2023
Merged

Conversation

orhun
Copy link
Owner

@orhun orhun commented Dec 5, 2023

Description

This PR makes it possible to use a template for the footer.

Before:

# changelog footer
footer = """
<!-- generated by git-cliff -->
"""

After:

# template for the changelog footer
footer = """
<!-- generated by git-cliff at {{ now() | date(format="%Y-%m-%d") }} -->
"""

Motivation and Context

Now we can have links at the footer for having the exact format as Keep a Changelog specification:

# template for the changelog footer
footer = """
{% for release in releases %}\
    {% if release.version %}\
        {% if release.previous.version %}\
            [{{ release.version | trim_start_matches(pat="v") }}]: <REPO>/compare/{{ release.previous.version }}..{{ release.version }}
        {% endif %}\
    {% else %}\
        [unreleased]: <REPO>/compare/{{ release.previous.version }}..HEAD
    {% endif %}\
{% endfor %}
<!-- generated by git-cliff -->
"""

Closes #95

How Has This Been Tested?

  • Unit tests
  • Integration tests
  • Test fixtures

Types of Changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation (no code change)
  • Refactor (refactoring production code)
  • Other

Checklist:

  • My code follows the code style of this project.
  • I have updated the documentation accordingly.
  • I have formatted the code with rustfmt.
  • I checked the lints with clippy.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@codecov-commenter
Copy link

codecov-commenter commented Dec 5, 2023

Codecov Report

Attention: 9 lines in your changes are missing coverage. Please review.

Comparison is base (1e571c2) 43.40% compared to head (615ee6a) 43.76%.

Files Patch % Lines
git-cliff-core/src/changelog.rs 61.12% 7 Missing ⚠️
git-cliff-core/src/release.rs 0.00% 1 Missing ⚠️
git-cliff-core/src/template.rs 90.91% 1 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #369      +/-   ##
==========================================
+ Coverage   43.40%   43.76%   +0.37%     
==========================================
  Files          13       13              
  Lines         643      649       +6     
==========================================
+ Hits          279      284       +5     
- Misses        364      365       +1     
Flag Coverage Δ
unit-tests 43.76% <70.00%> (+0.37%) ⬆️

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.

@orhun orhun changed the title Support templating in the footer feat(changelog)!: support templating in the footer Dec 5, 2023
@orhun orhun merged commit 0945fa8 into main Dec 5, 2023
27 checks passed
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.

Enable having a footer like the KeepAChangelog one
2 participants