Files
pi-review/entrypoint.sh
Markus Hofstetter 3654e36a7b feat: add debug mode to capture agent tool log
When debug: true, the review comment includes a collapsible section
showing which files the agent read, grep patterns used, etc.
Also prints agent log on failure for easier troubleshooting.
2026-05-18 23:14:51 +02:00

31 lines
1.4 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
# ─── Entrypoint for Docker action ────────────────────────────────────────────
# Docker actions receive inputs as INPUT_<NAME> env vars.
# We map them to PI_* vars that review.sh expects, then run the review.
# ──────────────────────────────────────────────────────────────────────────────
# Map Docker action inputs to review.sh env vars
export PI_API_KEY="${INPUT_API_KEY}"
export PI_PROVIDER="${INPUT_PROVIDER:-zai}"
export PI_MODEL="${INPUT_MODEL:-glm-5.1}"
export PI_BASE_URL="${INPUT_BASE_URL:-}"
export PI_TOOLS="${INPUT_TOOLS:-read,grep,find,ls}"
export PI_REVIEW_PROMPT="${INPUT_REVIEW_PROMPT:-}"
export PI_EXCLUDE="${INPUT_EXCLUDE_PATTERNS:-*.lock package-lock.json yarn.lock pnpm-lock.yaml *.min.js *.min.css *.map}"
export PI_MAX_DIFF="${INPUT_MAX_DIFF_BYTES:-80000}"
export PI_TOKEN="${INPUT_TOKEN}"
export PI_DEBUG="${INPUT_DEBUG:-false}"
# The calling repo is mounted at GITHUB_WORKSPACE by both GitHub and Gitea.
# cd into it so git commands work against the right repo.
cd "${GITHUB_WORKSPACE:-/github/workspace}"
echo "Workspace: $(pwd)"
echo "Provider: ${PI_PROVIDER}"
echo "Model: ${PI_MODEL}"
# Run the review
bash /action/scripts/review.sh