Commit Graph

7 Commits

Author SHA1 Message Date
Markus Hofstetter
15df936641 fix: use token for git auth inside Docker container
actions/checkout@v5 stores credentials in $RUNNER_TEMP which is not
mounted into the Docker container. Instead of requiring a pre-fetch
step in the workflow, we now inject the token into the remote URL
so git operations work inside the container.

Workflow no longer needs the 'Fetch base branch' pre-step.
v6
2026-05-20 00:18:03 +02:00
Markus Hofstetter
cfc5ae1d5c fix: check existing refs before trying to fetch inside Docker
The Docker container has no git auth credentials. Instead of trying
to fetch (which silently fails), first check if origin/main already
exists from a workflow pre-step. Only fall back to fetching if no
refs are found, with a clear error message telling users to add a
pre-fetch step.
v5
2026-05-20 00:13:25 +02:00
Markus Hofstetter
81edd958f9 fix: diff generation for PR checkouts
actions/checkout for PRs only fetches refs/pull/N/head into FETCH_HEAD.
Remote tracking branches (origin/main) don't exist.

Fix: explicit refspec fetch (refs/heads/main:refs/remotes/origin/main)
with fallback to GITEA_BASE_REF / GITHUB_BASE_REF for the target branch.
Also removed --filter=blob:none which could cause empty diffs.
Added diagnostic logging for base ref and file stats.
v4
2026-05-19 00:47:01 +02:00
Markus Hofstetter
bb34a3f2ec fix: debug mode now extracts tool calls from Pi session file
Pi doesn't log tool calls to stderr in print mode. Instead, we save
the session (.jsonl) and parse it to extract every tool_use entry
showing which files were read, grep patterns used, etc.
2026-05-18 23:51:36 +02:00
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
c2f0d7f43f Update Dockerfile 2026-05-18 22:11:52 +02:00
Markus Hofstetter
28b4b23550 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
2026-05-18 22:09:46 +02:00