Reusable Gitea/GitHub action that runs Pi coding agent for AI-powered code reviews on pull requests. - Docker image based on node:24-slim (112 packages) - Supports built-in providers (zai, anthropic, openai, deepseek, openrouter) and custom OpenAI-compatible endpoints - Generates git diff (excludes lockfiles/generated code by default) - Posts review as idempotent PR comment (updates existing on re-run) - Read-only tools only: agent investigates but never modifies code - 80KB default diff truncation to stay within LLM context windows - No curl/python3 dependency — uses Node.js for HTTP and JSON
44 lines
1.4 KiB
YAML
44 lines
1.4 KiB
YAML
name: "Pi Code Review"
|
|
description: "AI-powered code review using the Pi coding agent framework with any LLM provider"
|
|
author: "homa"
|
|
|
|
inputs:
|
|
api_key:
|
|
description: "API key for the LLM provider"
|
|
required: true
|
|
provider:
|
|
description: "Pi provider name (zai, anthropic, openai, openrouter, deepseek) or 'custom' for models.json config"
|
|
required: false
|
|
default: "zai"
|
|
model:
|
|
description: "Model ID (e.g. glm-4.7, claude-sonnet-4-20250514, gpt-4o)"
|
|
required: false
|
|
default: "glm-5.1"
|
|
base_url:
|
|
description: "Custom API base URL (for OpenAI-compatible providers). Ignored for built-in providers."
|
|
required: false
|
|
default: ""
|
|
token:
|
|
description: "Git platform token for posting PR comments"
|
|
required: true
|
|
review_prompt:
|
|
description: "Path to a custom review prompt file (relative to calling repo root)"
|
|
required: false
|
|
default: ""
|
|
exclude_patterns:
|
|
description: "Space-separated glob patterns to exclude from the diff"
|
|
required: false
|
|
default: "*.lock package-lock.json yarn.lock pnpm-lock.yaml *.min.js *.min.css *.map"
|
|
tools:
|
|
description: "Comma-separated tools the agent can use (read-only recommended for CI)"
|
|
required: false
|
|
default: "read,grep,find,ls"
|
|
max_diff_bytes:
|
|
description: "Max diff size in bytes before truncation (0 = unlimited)"
|
|
required: false
|
|
default: "80000"
|
|
|
|
runs:
|
|
using: "docker"
|
|
image: "Dockerfile"
|