Skip to content

Add option to group updates of the same dependency #480

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

Merged
merged 1 commit into from
Feb 26, 2025

Conversation

lucacome
Copy link
Owner

@lucacome lucacome commented Feb 26, 2025

Summary by CodeRabbit

  • New Features

    • Introduced a configurable option to group dependency updates in generated release notes for a cleaner, consolidated view.
    • Added a new parameter in the action configuration to control dependency grouping.
  • Documentation

    • Updated the release action documentation to include additional input and output parameters, enhancing customization and clarity of release configurations.
  • Chores

    • Made behind-the-scenes adjustments to workflow and lint configurations to streamline processes without affecting functionality.

@github-actions github-actions bot added documentation Improvements or additions to documentation enhancement New feature or request tests labels Feb 26, 2025
Copy link
Contributor

coderabbitai bot commented Feb 26, 2025

Walkthrough

The changes introduce a new parameter for grouping dependency updates across multiple configuration, test, and source files. The updates include minor formatting fixes in workflow and lint configuration files, enhanced documentation in the README, and adjustments in action metadata. New test cases and updates to the release notes generation functions now support grouping dependency updates when enabled. Additionally, the input interface has been extended to capture the new flag. All modifications maintain existing functionality while expanding configurability.

Changes

File(s) Change Summary
.github/workflows/dependency-review.yml Updated the name field from a quoted string to a plain string.
.markdownlint-cli2.yaml Added node_modules/** to the ignore list for markdown linting.
README.md, action.yml Updated release action documentation; added new input parameters (collapse-after, group-dependencies, config-path, dry-run) and output parameters (release-header, release-footer), and included a new input in the action configuration (group-dependencies, default true).
tests/notes.test.ts, tests/release.test.ts, tests/version.test.ts Added tests verifying the new groupDependencies functionality and its effect on release notes grouping and version updates.
src/context.ts Added a new boolean property groupDependencies to the Inputs interface and updated the getInputs function to initialize it from the core input.
src/notes.ts Modified generateReleaseNotes and collapseSections to incorporate grouping of dependency updates; introduced the new function groupDependencyUpdates to consolidate dependency entries.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Context
    participant Notes
    participant DependencyGrouper

    User->>Context: Provide inputs (group-dependencies flag)
    Context-->>Notes: Return complete inputs
    Notes->>Notes: Start generating release notes
    alt Group dependencies enabled
      Notes->>DependencyGrouper: Call groupDependencyUpdates()
      DependencyGrouper-->>Notes: Return grouped dependency updates
    end
    Notes->>Notes: Collapse sections into final markdown
    Notes-->>User: Output release notes markdown
Loading

Poem

I'm a little rabbit with code so neat,
Hoping through changes on nimble feet.
Grouping updates with a twitch of my nose,
Where new flags and tests graciously impose.
With markdown and workflows, my joy overflows,
A bunny's happy dance as the new code grows! 🐇

✨ Finishing Touches
  • 📝 Docstrings were successfully generated. (♻️ Check again to generate again)

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 generate docstrings to generate docstrings for this 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

🧹 Nitpick comments (3)
README.md (1)

7-7: Potential formatting issue with [!NOTE].

GitHub Flavored Markdown may not render [!NOTE] as expected. Consider using a standard blockquote for clarity.

src/notes.ts (2)

111-160: Manual parsing approach.

The logic is straightforward but somewhat verbose. Overall, it effectively segments the header, category sections, and footer.

Consider a simpler or more structured parser approach if maintainability becomes an issue.


280-348: Regex-based approach for Renovate and Dependabot.

Effectively groups repeated dependencies while preserving the earliest version and PR links. Consider handling edge cases for non-semver or special dependency names if needed.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0b9c5bd and 1a1e8a6.

⛔ Files ignored due to path filters (4)
  • dist/context.d.ts is excluded by !**/dist/**
  • dist/index.js is excluded by !**/dist/**
  • dist/index.js.map is excluded by !**/dist/**, !**/*.map
  • dist/notes.d.ts is excluded by !**/dist/**
📒 Files selected for processing (9)
  • .github/workflows/dependency-review.yml (1 hunks)
  • .markdownlint-cli2.yaml (1 hunks)
  • README.md (3 hunks)
  • __tests__/notes.test.ts (4 hunks)
  • __tests__/release.test.ts (1 hunks)
  • __tests__/version.test.ts (1 hunks)
  • action.yml (1 hunks)
  • src/context.ts (2 hunks)
  • src/notes.ts (3 hunks)
✅ Files skipped from review due to trivial changes (2)
  • .github/workflows/dependency-review.yml
  • .markdownlint-cli2.yaml
🔇 Additional comments (22)
action.yml (1)

33-36: New parameter for dependency grouping looks good!

The addition of the group-dependencies parameter with a clear description and appropriate default value aligns well with the overall action design. This will provide users with flexibility in how dependencies are presented in release notes.

__tests__/release.test.ts (1)

150-150: Properly updated test configuration

The test inputs object has been correctly updated to include the new groupDependencies parameter with the default value of true, maintaining consistency with the action.yml configuration.

__tests__/version.test.ts (1)

17-17: Test inputs updated correctly

The fakeInputs object has been properly updated to include the new groupDependencies parameter with the default value of true, maintaining consistency with other test files and the action configuration.

src/context.ts (2)

15-15: Interface updated correctly for new parameter

The Inputs interface has been properly extended with the new groupDependencies boolean property.


30-30: Input initialization implemented properly

The getInputs function correctly retrieves the group-dependencies value using the appropriate getBooleanInput method, which handles the string-to-boolean conversion.

__tests__/notes.test.ts (10)

2-2: The import looks good.

The new import for groupDependencyUpdates is consistent with its usage in this file.


86-86: No concerns with this new property.

groupDependencies is set to true, aligning with the intended test scenario.


126-126: Consistent usage of groupDependencies.

Repeating the input further ensures coverage for grouping logic.


323-325: Documentation comment note.

These lines only contain a comment instructing future additions, no functional impact.


327-344: Thorough test for Renovate dependency grouping.

Verifies combining multiple versions of the same dependency into a single line item. Looks correct and complete.


346-364: Dependabot grouping test is clear.

Ensures that multiple bump lines for the same dependency are consolidated properly.


366-394: Comprehensive test for mixed grouping scenarios.

Confirmed that grouping only occurs within the same section. This is expected behavior and is well-validated.


395-418: Valid test covering ungrouped dependencies.

Verifies that different dependency names remain separate, confirming correct grouping boundaries.


419-438: Good coverage for empty sections.

Ensures the grouping logic gracefully bypasses empty or unrelated items, preserving original structure.


439-451: Ensures original sections are preserved.

Guarantees no unexpected merges across different categories. The test scenario is well covered.

README.md (2)

40-53: Documented new input parameters.

The table is well-structured and clearly explains the new inputs. Usage details are consistent with the code.


64-65: New output parameters.

release-header and release-footer offer more customization in the release notes.

src/notes.ts (5)

57-62: Conditional grouping logic.

Invoking groupDependencyUpdates only if groupDependencies is true is a clean approach that preserves existing behavior by default.


98-106: Updated docstring.

The expanded explanation clarifies how sections are collapsed. It's helpful and accurate.


161-209: Section collapsing logic.

Appropriately uses <details> to collapse sections exceeding the threshold. Implementation is concise and matches the docstring.


248-253: New function signature for grouping dependencies.

Clear doc comment specifying the behavior and return structure.


350-399: Second pass: constructing consolidated entries.

Correctly merges all references for the same dependency while preserving the order of non-dependency items.

@lucacome lucacome removed the tests label Feb 26, 2025
coderabbitai bot added a commit that referenced this pull request Feb 26, 2025
Docstrings generation was requested by @lucacome.

* #480 (comment)

The following files were modified:

* `src/context.ts`
* `src/notes.ts`
Copy link
Contributor

coderabbitai bot commented Feb 26, 2025

Note

Generated docstrings for this pull request at #481

@lucacome lucacome merged commit 7205c58 into main Feb 26, 2025
14 of 15 checks passed
@lucacome lucacome deleted the feat/group-dependencies branch February 26, 2025 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant