Skip to content

Feat/failover labels #91

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 5 commits into from
Aug 4, 2024
Merged

Feat/failover labels #91

merged 5 commits into from
Aug 4, 2024

Conversation

Renato66
Copy link
Owner

@Renato66 Renato66 commented Aug 4, 2024

closes #18

document #24

Copy link
Contributor

coderabbitai bot commented Aug 4, 2024

Caution

Review failed

The pull request is closed.

Walkthrough

The recent changes enhance the auto-labeling functionality by introducing the failover-labels configuration option. This feature ensures that default labels are applied when none are explicitly mentioned in an issue. Additionally, the include-title option allows for more flexible label searches. These modifications improve both the configuration structure and the underlying logic, resulting in a more robust and user-friendly labeling system.

Changes

Files Change Summary
.github/workflows/auto-label.json5, action.yml, src/domain/getConfigFile.ts, src/domain/getLabelConfigs.ts, src/runner.ts Introduced failover-labels for fallback label management. Added include-title for flexible label searches.
src/runner.spec.ts, src/scraper/text.spec.ts Updated tests to reflect new label handling dynamics and adjusted assertions for scenarios including failover options.
src/scraper/text.ts Refined label comparison and issue label retrieval functions by removing unnecessary default label handling.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Issue
    participant LabelManager
    participant ConfigLoader

    User->>Issue: Create Issue without specific labels
    Issue->>ConfigLoader: Load configuration
    ConfigLoader->>LabelManager: Retrieve labels (including failover)
    LabelManager-->>ConfigLoader: Return applicable labels
    ConfigLoader-->>Issue: Apply labels (including failover labels if needed)
    Issue->>User: Issue created with labels
Loading

Assessment against linked issues

Objective Addressed Explanation
Allow registration of a label if none found in the issue (Issue #18)
Provide configuration options for label management
Enhance label flexibility by including titles in searches

Poem

🐇 In the garden, labels bloom,
With failover seeds, we chase the gloom.
Titles dance in the labeling light,
Issues rejoice, their futures bright!
Hopping through code, we find our way,
Happy labels, come what may! 🌼


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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: 1

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 3f40fba and 2dd48b0.

Files selected for processing (8)
  • README.md (2 hunks)
  • action.yml (1 hunks)
  • src/domain/getConfigFile.ts (3 hunks)
  • src/domain/getLabelConfigs.ts (1 hunks)
  • src/runner.spec.ts (4 hunks)
  • src/runner.ts (2 hunks)
  • src/scraper/text.spec.ts (1 hunks)
  • src/scraper/text.ts (4 hunks)
Additional comments not posted (18)
action.yml (1)

26-28: LGTM! The new input parameter failover-labels is well-integrated.

The addition of the failover-labels parameter enhances the flexibility of the workflow by providing a fallback mechanism for labels.

src/scraper/text.spec.ts (3)

10-10: LGTM! The function call simplification improves readability.

The removal of the empty array argument for default labels streamlines the function's interface.


18-18: LGTM! The function call simplification improves readability.

The removal of the empty array argument for default labels streamlines the function's interface.


28-28: LGTM! The function call simplification improves readability.

The removal of the empty array argument for default labels streamlines the function's interface.

src/domain/getConfigFile.ts (2)

7-7: LGTM! The new property failoverLabels is well-integrated.

The addition of the failoverLabels property enhances the configuration structure by allowing for a fallback mechanism for labels.


20-20: LGTM! The getConfigFile function is correctly modified to include failoverLabels.

The modification ensures that the new configuration option is populated correctly and integrated into the overall configuration output.

Also applies to: 35-35

src/scraper/text.ts (2)

Line range hint 9-22:
LGTM! Conditional creation of labelsRegex is correct.

The changes ensure that labelsRegex is only created if labels is not empty, preventing potential errors when labelsRegex is null.


54-54: LGTM! Simplified return values in getIssueLabels.

The removal of defaultLabels and returning only selectedLabels simplifies the function and aligns with the PR objectives.

src/runner.ts (2)

25-26: LGTM! Added failoverLabels to configuration retrieval.

The addition of failoverLabels enhances the functionality by providing fallback labels when primary labels are absent.


56-61: LGTM! Improved label application logic.

The changes ensure that issues are labeled more robustly by using failoverLabels when no primary labels are found. The logging statements have been refined for clarity.

src/domain/getLabelConfigs.ts (1)

52-52: LGTM! Added failoverLabels to configObject.

The inclusion of failoverLabels enhances the function's capability to handle more complex label configurations.

src/runner.spec.ts (3)

30-30: LGTM!

The dynamic assignment of getRepoLabels enhances the flexibility of the test cases.


32-33: LGTM!

The mocks for addLabels and getRepoLabels are appropriate for isolating the run function during testing.


49-49: LGTM!

The updated assertion ensures that the correct arguments are passed to addLabelsSpy.

README.md (4)

69-69: LGTM!

The include-title option allows users to include or exclude the title in the labels search.


71-71: LGTM!

The failover-labels option specifies labels to be applied when no labels are found in the issue text.


226-236: LGTM!

The Include Title section provides clear instructions on how to use the include-title option.


245-265: LGTM!

The Failover Labels section provides clear instructions on how to use the failover-labels option.

@Renato66 Renato66 merged commit d7eefe6 into main Aug 4, 2024
1 check passed
@Renato66 Renato66 deleted the feat/failover-labels branch August 4, 2024 22:31
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.

Feature: Opção failover/padrão
1 participant