Files
openrabbit/docs/AI.md
latte 8cadb2d216
Some checks failed
Docker / docker (push) Successful in 6s
Security / security (push) Successful in 6s
Deploy / deploy-local-runner (push) Has been cancelled
CI / ci (push) Successful in 1m42s
Deploy / deploy-ssh (push) Successful in 7s
Add Gitea Actions workflows, CI config, and docs
2026-02-28 20:40:14 +01:00

4.2 KiB

AI Workflows — ${REPO_NAME}

Overview

This template includes five AI-powered workflows that use the OpenRabbit tooling to provide automated code review, issue triage, and interactive chat via a bot (default: @codebot / user Bartender).

All AI workflows check out the central Hiddenden/openrabbit repo at runtime and execute its Python-based tools. No AI code lives in your repository.

Workflows

1. Enterprise AI Code Review (enterprise-ai-review.yml)

  • Trigger: Pull request opened or updated
  • What it does: Automatically reviews PR diffs for code quality, bugs, security issues, and style. Posts findings as PR comments.
  • Severity gating: If the review finds HIGH severity issues, CI fails (optional — see the Check Review Result step).

2. AI Issue Triage (ai-issue-triage.yml)

  • Trigger: Comment containing @codebot triage on any issue
  • What it does: Analyzes the issue content and applies appropriate labels, priority, and category suggestions.

3. AI Comment Reply (ai-comment-reply.yml)

  • Trigger: Comment containing a specific @codebot command
  • Supported commands:
    • @codebot help — show available commands
    • @codebot explain — explain code or issue context
    • @codebot suggest — suggest improvements
    • @codebot security — security-focused analysis
    • @codebot summarize — summarize a thread
    • @codebot changelog — generate changelog entries
    • @codebot explain-diff — explain PR diff
    • @codebot review-again — re-run review
    • @codebot setup-labels — configure repo labels
  • PR vs Issue: Automatically detects whether the comment is on a PR or issue and dispatches accordingly.

4. AI Chat (ai-chat.yml)

  • Trigger: Comment mentioning @codebot that is NOT a known command
  • What it does: Free-form AI chat. Ask the bot any question and it will respond using the codebase context and optional web search (SearXNG).
  • Routing: This is the fallback — only fires when no specific command matches.

5. AI Codebase Quality Review (ai-codebase-review.yml)

  • Trigger: Manual (workflow_dispatch) or scheduled (weekly, commented out)
  • What it does: Full codebase analysis generating a quality report.
  • Report types: full, security, quick (selectable on manual trigger).

Required Secrets

All AI workflows require these secrets in your repository (Settings → Actions → Secrets):

Secret Required Description
AI_REVIEW_TOKEN Yes Gitea PAT with repo access (to check out OpenRabbit and post comments)
OPENAI_API_KEY Conditional OpenAI API key (if using OpenAI models)
OPENROUTER_API_KEY Conditional OpenRouter API key (if using OpenRouter)
OLLAMA_HOST Conditional Ollama server URL (if using self-hosted models)
SEARXNG_URL Optional SearXNG instance URL for web search in AI chat

At least one AI provider key (OPENAI_API_KEY, OPENROUTER_API_KEY, or OLLAMA_HOST) must be set.

Customization

Changing the Bot Name

The default bot is @codebot (Gitea user: Bartender). To change it:

  1. Update the if: conditions in all AI workflows to match your bot's mention prefix.
  2. Update the github.event.comment.user.login != 'Bartender' check to your bot's username.
  3. Update config.yml in the OpenRabbit tooling if applicable.

Loop Prevention

All AI workflows check github.event.comment.user.login != 'Bartender' to prevent the bot from responding to its own comments. This is critical — without it, the bot can trigger infinite loops.

Workflow Routing

The three comment-triggered workflows are carefully routed to avoid duplicates:

Issue comment with @codebot
├── Contains "triage"?         → ai-issue-triage.yml
├── Contains known command?    → ai-comment-reply.yml
└── Free-form mention?         → ai-chat.yml (fallback)

Enabling / Disabling

To disable AI workflows without deleting them, either:

  • Remove the workflow files from .gitea/workflows/
  • Or comment out the on: triggers in each file

To enable the scheduled codebase review, uncomment the schedule trigger in ai-codebase-review.yml.