Skip to content
New issue

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

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

Already on GitHub? # to your account

Move logic for release notes generation from Python script to Jinja template (release CI) #44

Merged
merged 2 commits into from
Sep 25, 2024

Conversation

2bndy5
Copy link
Collaborator

@2bndy5 2bndy5 commented Sep 25, 2024

Summary by CodeRabbit

  • New Features

    • Automation of version bump and release workflows added.
    • Enhanced changelog structure with sections for unreleased changes and release candidates, including links to commit diffs for better traceability.
  • Bug Fixes

    • Improved logic for processing release notes to ensure accurate appending of notes.
  • Documentation

    • Updated changelog to reflect new automation features and improved navigation through the project's history.

@2bndy5 2bndy5 added the documentation Improvements or additions to documentation label Sep 25, 2024
Copy link
Contributor

coderabbitai bot commented Sep 25, 2024

Walkthrough

The changes involve updates to the logic for processing release notes in the get_release_notes function, modifications to the changelog format, and enhancements to the cliff.toml configuration. The release notes logic now focuses on appending lines only when certain conditions are met, while the changelog has been structured to improve clarity and traceability of changes across versions. Additionally, the cliff.toml file includes new variables for versioning and commit tracking, streamlining the changelog generation process.

Changes

Files Change Summary
.github/workflows/bump_version.py Modified the get_release_notes function to change how release notes are processed, specifically removing checks for "[unreleased]: " and altering line handling.
CHANGELOG.md Updated to include new entries for changelog automation, modified previous entries, and added sections for unreleased changes and release candidates with links.
cliff.toml Adjusted template logic for changelog generation, added new variables for commit tracking, and modified version handling logic.

Possibly related PRs

Suggested labels

enhancement

Poem

🐰 In the garden where notes do bloom,
A changelog dances, dispelling gloom.
With each version, a tale to tell,
Of bumps and tweaks, all crafted well.
Hops of joy for the code we share,
A rabbit's cheer fills the air! 🌼


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    -- I pushed a fix in commit <commit_id>, please review it.
    -- Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    -- @coderabbitai generate unit testing code for this file.
    -- @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    -- @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    -- @coderabbitai read src/utils.ts and generate unit testing code.
    -- @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    -- @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Outside diff range and nitpick comments (6)
cliff.toml (4)

20-25: LGTM! Consider using a constant for "Unreleased".

The introduction of init_commit and this_version variables, along with the logic to set this_version based on the input version, looks good. It provides a clear way to handle both released and unreleased versions in the changelog.

Consider defining "Unreleased" as a constant at the top of the file, as it's used multiple times. This would make future updates easier and ensure consistency. For example:

{% set UNRELEASED = "Unreleased" %}
# ... other code ...
{% set this_version = UNRELEASED %}
# ... use UNRELEASED instead of "Unreleased" in other places

47-54: LGTM! Consider adding comments for clarity.

The logic for determining first_commit and last_commit is well-structured and covers all necessary cases. It properly handles scenarios with and without previous versions.

Consider adding brief comments to explain the logic, especially for the first_commit fallback to init_commit. This would enhance maintainability. For example:

{% set first_commit = previous.version %}
{% set last_commit = "HEAD" %}
{% if version %}
    {% set last_commit = version %}
    {% if not previous.version %}
        {# If this is the first versioned release, use the initial commit #}
        {% set first_commit = init_commit %}
    {% endif %}
{% endif %}

55-61: LGTM! Consider consistent formatting for commit hashes.

The addition of comparison and full commit diff links enhances the changelog's usefulness. The conditional logic for handling the initial commit in the full diff link is well-thought-out.

For consistency, consider using the same truncation for both init_commit and first_commit in the full diff link. Currently, only init_commit is truncated. You could apply the same truncation to first_commit:

Full commit diff: [`{% if previous.version -%}
    {{ first_commit | truncate(length=7, end="") }}
{%- else -%}
    {{ init_commit | truncate(length=7, end="") }}
{%- endif %}...{{ last_commit }}`][{{ this_version }}]

This ensures that regardless of which commit is used, it's displayed in the same format.


Line range hint 1-150: Overall, these changes significantly enhance the changelog generation process.

The modifications to cliff.toml align well with the PR objective of moving logic from a Python script to the Jinja template. Key improvements include:

  1. Introduction of variables for better version handling (init_commit, this_version, first_commit, last_commit).
  2. Enhanced logic for determining version ranges in the changelog.
  3. Addition of comparison and full commit diff links for better traceability.

These changes make the changelog more informative and flexible, especially in handling different release scenarios (initial release, subsequent releases, unreleased changes). The use of Jinja templating allows for more dynamic content generation directly in the configuration file.

To further improve maintainability and consistency:

  1. Consider extracting commonly used strings (like "Unreleased") into constants at the top of the file.
  2. Add comments to explain complex logic, especially around version comparisons and link generation.
  3. Ensure consistent formatting throughout the template, particularly for commit hash displays.

These enhancements will make the configuration more robust and easier to maintain as the project evolves.

CHANGELOG.md (2)

13-13: LGTM! Consider adding dates to unreleased changes.

The new entry for automation of version bump and release workflows is well-documented, including attribution and a link to the pull request. The addition of a full commit diff link for unreleased changes is an excellent practice for transparency.

Consider adding a date or date range for the unreleased changes to give readers a sense of how recent these changes are. For example:

## [Unreleased] - 2024-09-21 to present

Also applies to: 27-30


135-136: LGTM! Comprehensive first release candidate section.

The new section for the first release candidate 2.0.0-rc1 is well-structured and highly informative. It maintains consistency with other sections while providing more detailed information about the changes, which is appropriate for the first release candidate. The inclusion of the release date, comparison link, and full commit diff link continues to provide excellent traceability.

Consider adding a brief summary or highlights of the most significant changes in this first release candidate at the beginning of the section. This can help readers quickly grasp the major updates without having to go through the entire list of changes.

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between afd9198 and bc05419.

Files selected for processing (3)
  • .github/workflows/bump_version.py (0 hunks)
  • CHANGELOG.md (5 hunks)
  • cliff.toml (3 hunks)
Files not reviewed due to no reviewable changes (1)
  • .github/workflows/bump_version.py
Additional comments not posted (6)
cliff.toml (2)

45-46: LGTM! Improved readability.

The addition of empty lines after the commit grouping loop enhances the readability of the generated changelog.


80-80: Clarify the reason for commenting out the output configuration.

The output configuration has been commented out. While this will allow git-cliff to use its default output behavior, it's unclear why this change was made.

Could you please clarify the reasoning behind this change? Is the output being handled differently in the CI process now? If so, it might be helpful to add a comment explaining the new approach:

# output = "CHANGELOG.md"  # Output is now handled in the CI pipeline

This would help future maintainers understand the intentional omission of this configuration.

CHANGELOG.md (4)

41-44: LGTM! Well-structured release candidate section.

The new section for release candidate 2.0.0-rc4 is well-structured and informative. The inclusion of the release date, comparison link, and full commit diff link greatly enhances the traceability of changes between versions.


52-55: LGTM! Consistent structure maintained.

The new section for release candidate 2.0.0-rc3 maintains the consistent structure established in the previous section. The inclusion of the release date, comparison link, and full commit diff link continues to provide excellent traceability between versions.


73-76: LGTM! Consistent structure maintained across release candidates.

The new section for release candidate 2.0.0-rc2 continues to maintain the consistent structure established in the previous sections. The inclusion of the release date, comparison link, and full commit diff link provides excellent traceability between versions.


Line range hint 1-136: Excellent improvements to the changelog structure and content!

The changes made to the CHANGELOG.md file significantly enhance its usefulness and readability:

  1. Consistent structure across all sections (Unreleased and release candidates).
  2. Enhanced traceability with comparison links and full commit diff links for each version.
  3. Clear adherence to the Keep a Changelog format and Semantic Versioning.
  4. Detailed categorization of changes (Added, Fixed, Dependency updates, etc.) within each section.

These improvements make it much easier for users and contributors to understand the project's evolution and find specific changes between versions.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Outside diff range and nitpick comments (3)
CHANGELOG.md (3)

9-31: LGTM! Consider adding more details to some entries.

The new "Unreleased" section follows the Keep a Changelog format and provides a clear overview of recent changes. The addition of the "Dependency updates" section is a good practice for tracking dependencies.

Consider adding more details to some entries, such as the one in line 30:

- Move logic from py script to jinja template (release CI) in [`bc05419`](https://github.com/cpp-linter/cpp_linter_rs/commit/bc05419920e15704352d344a4fa7da67824cc776)
+ Move logic for release notes generation from Python script to Jinja template (release CI) in [`bc05419`](https://github.com/cpp-linter/cpp_linter_rs/commit/bc05419920e15704352d344a4fa7da67824cc776)

This provides more context about the specific logic that was moved.

Tools
LanguageTool

[grammar] ~25-~25: There seems to be a noun/verb agreement error. Did you mean “follows” or “followed”?
Context: ...8 --> 📝 Documentation - Release trial follow up by @2bndy5 in [#41](https://github.c...

(SINGULAR_NOUN_VERB_AGREEMENT)


Line range hint 32-81: LGTM! Consider standardizing the format of commit messages.

The new sections for release candidates 2.0.0-rc4, 2.0.0-rc3, and 2.0.0-rc2 are well-structured and provide clear information about the changes. The inclusion of full commit diff links improves traceability.

For consistency, consider standardizing the format of commit messages. For example, in the 2.0.0-rc3 section:

- [node] add life cycle script prepublishOnly by @2bndy5 in [`55650ea`](https://github.com/cpp-linter/cpp_linter_rs/commit/55650ea96aac628023acb120525d674bcf17a529)
+ Add life cycle script prepublishOnly for node by @2bndy5 in [`55650ea`](https://github.com/cpp-linter/cpp_linter_rs/commit/55650ea96aac628023acb120525d674bcf17a529)

This format aligns better with the other entries and provides clearer information.


Line range hint 82-139: LGTM! Consider adding more context to some entries.

The 2.0.0-rc1 section provides a comprehensive and well-categorized list of changes for the first release candidate. This level of detail is excellent for tracking the project's progress.

To further improve clarity, consider adding more context to some entries. For example:

- Init commit by @2bndy5 in [`2e25fec`](https://github.com/cpp-linter/cpp_linter_rs/commit/2e25fec0a447df24d0bcc1b80f6624040bab755e)
+ Initial commit: Project setup and basic structure by @2bndy5 in [`2e25fec`](https://github.com/cpp-linter/cpp_linter_rs/commit/2e25fec0a447df24d0bcc1b80f6624040bab755e)

This provides more information about what the initial commit included.

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between bc05419 and 5218094.

Files selected for processing (2)
  • CHANGELOG.md (4 hunks)
  • cliff.toml (3 hunks)
Files skipped from review as they are similar to previous changes (1)
  • cliff.toml
Additional context used
LanguageTool
CHANGELOG.md

[grammar] ~25-~25: There seems to be a noun/verb agreement error. Did you mean “follows” or “followed”?
Context: ...8 --> 📝 Documentation - Release trial follow up by @2bndy5 in [#41](https://github.c...

(SINGULAR_NOUN_VERB_AGREEMENT)

Additional comments not posted (2)
CHANGELOG.md (2)

140-141: LGTM! Excellent addition of full commit diff links.

The inclusion of full commit diff links for each version significantly enhances the changelog's traceability. This allows developers to easily view all changes between versions.


25-25: Note on grammar: Current phrasing is acceptable in this context.

The static analysis tool flagged a potential noun/verb agreement issue in the phrase "Release trial follow up". However, in the context of a changelog entry, this concise format is acceptable and commonly used. It effectively conveys the nature of the change without requiring strict grammatical structure.

If you prefer to adhere to more formal grammar, you could consider:

- Release trial follow up by @2bndy5 in [#41](https://github.com/cpp-linter/cpp_linter_rs/pull/41)
+ Release trial follow-up by @2bndy5 in [#41](https://github.com/cpp-linter/cpp_linter_rs/pull/41)

This adds a hyphen to create a compound modifier, which is grammatically correct. However, the current form is also acceptable in this context.

Tools
LanguageTool

[grammar] ~25-~25: There seems to be a noun/verb agreement error. Did you mean “follows” or “followed”?
Context: ...8 --> 📝 Documentation - Release trial follow up by @2bndy5 in [#41](https://github.c...

(SINGULAR_NOUN_VERB_AGREEMENT)

@2bndy5 2bndy5 changed the title move logic from py script to jinja template (release CI) Move logic for release notes generation from Python script to Jinja template (release CI) Sep 25, 2024
@2bndy5 2bndy5 merged commit 0f1a348 into main Sep 25, 2024
10 checks passed
@2bndy5 2bndy5 deleted the update-cliff-config branch September 25, 2024 04:18
@coderabbitai coderabbitai bot mentioned this pull request Sep 28, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant