Skip to content

CherryHQ/cherry-bot

Cherry Bot 🍒 - AI-Powered GitHub Labeling Assistant

Cherry Bot is a GitHub App built with Probot that automatically labels your issues and pull requests using configurable rules and Large Language Models (LLMs).

Features

  • Rule-Based Labeling: Define rules in .github/cherry-bot.yml to automatically label issues/PRs based on title, body content, or changed files.
  • AI-Powered Suggestions: Leverages OpenAI (or compatible APIs) to analyze issue/PR content and suggest relevant labels from your defined list.
  • Configurable Confidence: Set a confidence threshold for AI suggestions to control when AI labels are applied.
  • Flexible Configuration: Define available labels, rules, and AI settings in a simple YAML file.

How it Works

  1. Event Trigger: Cherry Bot listens for issues (opened, edited) and pull_request (opened, edited, synchronize) events.
  2. Configuration Load: It reads the .github/cherry-bot.yml file in the repository.
  3. Rule Matching: It checks the issue/PR against the defined rules.
  4. AI Analysis (if configured): If an OpenAI API key is provided and rules allow, it sends the title and body to the LLM for label suggestions.
  5. Label Application: It applies labels based on matched rules and high-confidence AI suggestions.

Installation

  1. Install the GitHub App on your repository or organization.
  2. Grant the necessary permissions (Issues: Read & Write, Pull Requests: Read & Write, Contents: Read).

Configuration

Create a .github/cherry-bot.yml file in your repository (optional if only using AI features with default threshold):

# .github/cherry-bot.yml

# Label Definitions (Optional): If provided, can be used for reference or future features.
# The bot now dynamically fetches labels from your repository for AI analysis.
# labels:
#   - name: bug
#     description: "Something isn't working"
#     color: "d73a4a"
#   - name: feature
#     description: "New feature or request"
#     color: "0075ca"

# AI Settings (Optional): Configure AI-powered label suggestions.
# Requires OPENAI_API_KEY environment variable set for the bot.
# You might also need OPENAI_BASE_URL if using a proxy or compatible API.
ai:
  threshold: 0.8 # Default: 0.8. AI suggestions below this confidence score won't be applied.
  
# Labeling Rules (Optional): Define conditions to automatically apply labels based on content.
# rules:
#   - name: "Bug Report"
#     match: 
#       title: ["bug", "fix", "issue", "error", "fail"]
#     labels: ["bug", "triage"]
#   ...

Note: The bot now automatically fetches the list of available labels directly from your GitHub repository when performing AI analysis. You no longer need to define the labels section for the AI to work, although providing it might be useful for documentation or future features like rule validation or label creation.

Development

See CONTRIBUTING.md.

License

ISC

About

A LLM-powered bot for handling PRs and issues

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published