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): allow adding custom context #613

Merged
merged 7 commits into from
Apr 21, 2024
Merged

feat(changelog): allow adding custom context #613

merged 7 commits into from
Apr 21, 2024

Conversation

MarcoIeni
Copy link
Contributor

@MarcoIeni MarcoIeni commented Apr 15, 2024

Description

This allows to add custom context from the users of git_cliff_core.

Motivation and Context

I need this in release-plz to inject the crate name in the changelog.
I protyped this in release-plz/release-plz#1399

I guess other people would benefit from this kind of feature as well :)

How Has This Been Tested?

Locally on the branch I showed you.
Not sure if you want to add the method add_context (or a similar approach) to the Changelog struct.
Lmk if you prefer to inject the context in another way 👍

Screenshots / Logs (if applicable)

release-plz/release-plz#916 (comment)

It contains multiple changelog updates (one for each package) in the same changelog file 🤯

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.

@MarcoIeni MarcoIeni marked this pull request as ready for review April 15, 2024 12:28
@MarcoIeni MarcoIeni requested a review from orhun as a code owner April 15, 2024 12:28
Copy link
Owner

@orhun orhun left a comment

Choose a reason for hiding this comment

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

Overall LGTM! Can you update one of the tests to verify the behavior of add_context?

git-cliff-core/src/changelog.rs Outdated Show resolved Hide resolved
git-cliff-core/src/config.rs Outdated Show resolved Hide resolved
@MarcoIeni
Copy link
Contributor Author

MarcoIeni commented Apr 16, 2024

feedback from doing this pr:

  • working with cargo nightly for cargo fmt is painful :( consider switching to stable to make the experience of contributors a bit better
  • the test git_log was failing with the last commit is not conventional. It took me a while to figure out the issues were my own commits D: I will now force-push, trying to not loose stuff 😅 Usually in PRs I don't respect conventional commits, and then I just squash.

@codecov-commenter
Copy link

codecov-commenter commented Apr 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 41.90%. Comparing base (d53b905) to head (2f6b1df).
Report is 4 commits behind head on main.

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

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #613      +/-   ##
==========================================
+ Coverage   41.52%   41.90%   +0.38%     
==========================================
  Files          15       15              
  Lines        1072     1079       +7     
==========================================
+ Hits          445      452       +7     
  Misses        627      627              
Flag Coverage Δ
unit-tests 41.90% <100.00%> (+0.38%) ⬆️

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.

@MarcoIeni MarcoIeni requested a review from orhun April 16, 2024 21:47
@orhun
Copy link
Owner

orhun commented Apr 17, 2024

Thanks for the feedback!

  • working with cargo nightly for cargo fmt is painful :( consider switching to stable to make the experience of contributors a bit better

I'm curious if there will be a lot of formatting changes, but I guess it is worth a shot. Can you submit an issue for it?

  • the test git_log was failing with the last commit is not conventional. It took me a while to figure out the issues were my own commits D: I will now force-push, trying to not loose stuff 😅 Usually in PRs I don't respect conventional commits, and then I just squash.

Yeah, I guess it is better to use a fixed commit instead of last commit for the conventional commit tests.

@MarcoIeni MarcoIeni mentioned this pull request Apr 21, 2024
1 task
@MarcoIeni
Copy link
Contributor Author

Can you submit an issue for it?

Done #618

Yeah, I guess it is better to use a fixed commit instead of last commit for the conventional commit tests.

I decided to delete that check entirely. Let me know if it's fine in #619

Are we ready to merge this in the meantime? 🚀

Copy link
Owner

@orhun orhun left a comment

Choose a reason for hiding this comment

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

LGTM!

@orhun orhun changed the title feat: allow adding custom context feat(changelog): allow adding custom context Apr 21, 2024
@orhun orhun merged commit 522bd53 into orhun:main Apr 21, 2024
44 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.

3 participants