feat: initial pi-review Docker action

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
This commit is contained in:
Markus Hofstetter
2026-05-18 22:09:46 +02:00
commit 28b4b23550
10 changed files with 428 additions and 0 deletions

43
action.yml Normal file
View File

@@ -0,0 +1,43 @@
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"