Skip to content

Optimize Auto Labeling for GitHub Issues #1326

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
Apr 20, 2025

Conversation

yashgoyal0110
Copy link
Contributor

@yashgoyal0110 yashgoyal0110 commented Apr 9, 2025

fixes: #1325

  • More Keywords – Added more synonyms to improve label accuracy.
  • Handles Empty Descriptions – Ensures the script doesn’t crash if an issue is missing a body.
  • More Efficient Matching – Uses .filter() and .map() instead of unnecessary loops.

@yashgoyal0110 yashgoyal0110 requested a review from arkid15r as a code owner April 9, 2025 18:52
Copy link
Contributor

coderabbitai bot commented Apr 9, 2025

Summary by CodeRabbit

  • New Features
    • Improved automated issue labeling with expanded keyword associations for more accurate categorization.
    • Introduced added validations to ensure issues include necessary details before labels are assigned.
    • Streamlined the label generation process for increased reliability.

Walkthrough

This pull request updates the GitHub Actions workflow for labeling issues. It replaces the existing keyword mapping with an improved object that includes extra keywords for various issue types. Additionally, the code now checks for the validity of the issue object and ensures the presence of the title or body before proceeding. The label generation is refactored using modern methods such as Object.entries(), filter(), and map().

Changes

File(s) Change Summary
.github/workflows/label-issues.yaml Updated keyword mapping to include additional keywords (e.g., "crash", "unexpected", "suggestion", "guidance"); added issue object validation; refactored label generation.

Assessment against linked issues

Objective Addressed Explanation
Enhance Auto Labeling (#1325)

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c95d029 and b4666ec.

📒 Files selected for processing (1)
  • .github/workflows/label-issues.yaml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/label-issues.yaml

🪧 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 plan to trigger planning for file edits and PR creation.
  • @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.

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.

@github-actions github-actions bot added the ci label Apr 9, 2025
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 (2)
.github/workflows/label-issues.yaml (2)

21-22: Robust Issue Validation
The added guard clause effectively verifies that the issue object exists and contains at least a title or body, which prevents subsequent errors when processing incomplete payloads.

Optional: Consider logging a message when the guard triggers to aid in debugging.


26-29: Enhanced Keyword Dictionary
The updated keywordMapping now includes additional synonyms (e.g., "crash", "unexpected", "suggestion", "guidance") that broaden the scope of issue keyword detection. This improvement should help capture a wider variety of issue descriptions.

Optional: If this mapping grows further, consider externalizing it to a configuration file for easier maintenance.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3ae6db3 and be0ff62.

📒 Files selected for processing (1)
  • .github/workflows/label-issues.yaml (1 hunks)
🔇 Additional comments (2)
.github/workflows/label-issues.yaml (2)

23-24: Case-Insensitive Matching Initialization
The conversion of both issue.title and issue.body to lowercase—with safe fallback to an empty string—ensures that keyword matching is performed in a case-insensitive manner. This standardizes the text processing and enhances label detection accuracy.


32-34: Efficient Label Generation
Leveraging Object.entries(), filter(), and map() creates a concise and efficient flow for generating the labels array based on the identified keywords. This modern approach improves code readability and performance compared to traditional loop constructs.

Copy link

@arkid15r arkid15r enabled auto-merge April 20, 2025 16:04
@arkid15r arkid15r added this pull request to the merge queue Apr 20, 2025
Merged via the queue into OWASP:main with commit 4d60d52 Apr 20, 2025
22 checks passed
shdwcodr pushed a commit to shdwcodr/Nest that referenced this pull request Jun 5, 2025
* commit

* commit

* commit

---------

Co-authored-by: Arkadii Yakovets <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enhance Auto Labeling for Issues in GitHub Actions
2 participants