- Notifications
You must be signed in to change notification settings - Fork70
pr pre-flight, github action version#5558
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
github-actionsbot commentedNov 20, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Review updated until commit4137af0 Description
|
| Relevant files | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Enhancement | 7 files
| ||||||||||||||
| Tests |
PR Reviewer Guide
Here are some key observations to aid the review process:
| 🧪 No relevant tests |
| ⚡ Recommended focus areas for review |
Formatting and Argument Handling |
greptile-appsbot commentedNov 20, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Greptile OverviewGreptile SummaryThis PR adds GitHub Actions workflows for automated PR reviews using Gemini and Claude AI backends. The implementation includes a Python launcher that orchestrates git operations, calls AI CLI tools with review prompts, and parses verdict markers from outputs. Key changes:
Critical issues found:
Notes:
Confidence Score: 2/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram participant GH as GitHub Actions participant Launcher as pr_preflight_launcher.py participant GitHelpers as git_helpers.py participant Wrapper as ai_cli_wrapper.py participant AI as AI CLI (Claude/Gemini) participant Router as Claude Code Router GH->>GH: Trigger on PR opened/synchronize GH->>GH: Checkout code with fetch-depth: 0 alt Claude Backend GH->>GH: Install Claude Code + Router GH->>GH: Write router config with escaped env vars GH->>Router: Start ccr (with env vars available) Note over Router: May fail if config has literal $VAR strings else Gemini Backend GH->>GH: Install Gemini CLI end GH->>Launcher: Run with --ai-backend and env vars Launcher->>Launcher: Parse args and build context Launcher->>GitHelpers: resolve_base_sha_from_ref(base_ref) GitHelpers-->>Launcher: base_sha Launcher->>GitHelpers: compute_merge_base_sha(base, head) GitHelpers-->>Launcher: merge_base_sha Launcher->>Launcher: Build review prompt with SHAs Launcher->>Wrapper: launch_ai_cli(tool, prompt, verdict_marker) Wrapper->>AI: Execute CLI with prompt and timeout AI->>AI: Analyze PR changes AI-->>Wrapper: Output with VERDICT: PASSED/FAILED Wrapper->>Wrapper: Parse output for verdict marker alt Verdict Found Wrapper->>Wrapper: Write success_raw_output.txt Wrapper->>Wrapper: Write review_verdict.txt Wrapper-->>Launcher: Exit code (0=passed, 3=failed) else Verdict Missing Wrapper->>Wrapper: Write error.txt (parsing error) Wrapper-->>Launcher: Exit code 4 end Launcher-->>GH: Return exit code alt Gemini Workflow GH->>GH: Read success_raw_output.txt GH->>GH: Post/update PR comment via GitHub API else Claude Workflow GH->>GH: Upload artifacts (no PR comment yet) end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
11 files reviewed, 7 comments
Edit Code Review Agent Settings |Greptile
React with 👍 or 👎 to share your feedback on this new summary format
tools/ai_cli_wrapper.py Outdated
| def launch_ai_cli( | ||
| prompt: str, | ||
| tool: None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
syntax: type annotation is incorrect -tool: None should betool: str | None
| tool:None, | |
| tool:str|None, |
tools/ai_cli_wrapper.py Outdated
| return 4 | ||
| except subprocess.TimeoutExpired: | ||
| error_msg = "{tool} command timed out after {timeout_seconds} seconds" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
syntax: missing 'f' prefix for f-string - this will output literal string instead of interpolating{tool} and{timeout_seconds}
| error_msg="{tool} command timed out after {timeout_seconds} seconds" | |
| error_msg=f"{tool} command timed out after{timeout_seconds} seconds" |
tools/ai_cli_wrapper.py Outdated
| return 1 | ||
| except FileNotFoundError: | ||
| error_msg = "Error: '{tool}' command not found. Is it installed and in PATH?" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
syntax: missing 'f' prefix for f-string - this will output literal string instead of interpolating{tool}
| error_msg="Error: '{tool}' command not found. Is it installed and in PATH?" | |
| error_msg=f"Error: '{tool}' command not found. Is it installed and in PATH?" |
tools/pr_preflight_launcher.py Outdated
| tool_args = [] | ||
| ok_commands = ["git", "ls", "grep", "ls","stat"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
syntax: "ls" appears twice in the list
| ok_commands= ["git","ls","grep","ls","stat"] | |
| ok_commands= ["git","ls","grep","stat"] |
| - name: Checkout code | ||
| uses: actions/checkout@v4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
logic: missingfetch-depth: 0 - without full git history,git merge-base inpr_preflight_launcher.py:85 will fail when computing the merge base between branches
| -name:Checkout code | |
| uses:actions/checkout@v4 | |
| -name:Checkout code | |
| uses:actions/checkout@v4 | |
| with: | |
| fetch-depth:0 |
tools/ai_cli_wrapper.py Outdated
| ensure_dir(OUTPUT_DIR) | ||
| if tool == None: | ||
| write_to_path(OUTPUT_DIR, "error.txt", f"Error (Exit 1 - no tool specified") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
syntax: missing closing parenthesis in error message
| write_to_path(OUTPUT_DIR,"error.txt",f"Error (Exit 1 - no tool specified") | |
| write_to_path(OUTPUT_DIR,"error.txt",f"Error (Exit 1 - no tool specified)") |
| @@ -0,0 +1,6 @@ | |||
| # once inside, can test with | |||
| # python3 /usr/local/bin/pr_preflight_launcher_gemini.py --output-dir=/tmp --base-sha=f8b8551a720cd5c3a9aa8950e5a50fb7d420cbe5 --head-sha=9f9a6b2f91519b3dc02fe7ec7a5f2a3b98398338 | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
syntax: outdated reference - file is nowpr_preflight_launcher.py, notpr_preflight_launcher_gemini.py
| # python3 /usr/local/bin/pr_preflight_launcher_gemini.py --output-dir=/tmp --base-sha=f8b8551a720cd5c3a9aa8950e5a50fb7d420cbe5 --head-sha=9f9a6b2f91519b3dc02fe7ec7a5f2a3b98398338 | |
| # python3 /usr/local/bin/pr_preflight_launcher.py --output-dir=/tmp --base-sha=f8b8551a720cd5c3a9aa8950e5a50fb7d420cbe5 --head-sha=9f9a6b2f91519b3dc02fe7ec7a5f2a3b98398338 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
11 files reviewed, 5 comments
Edit Code Review Agent Settings |Greptile
React with 👍 or 👎 to share your feedback on this new summary format
| - name: Run Claude Code via wrapper | ||
| env: | ||
| ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} | ||
| ANTHROPIC_BASE_URL: http://localhost:3456 | ||
| PR_NUMBER: ${{ github.event.pull_request.number }} | ||
| PR_SHA: ${{ github.event.pull_request.head.sha }} | ||
| PR_BASE_REF: ${{ github.event.pull_request.base.ref }} | ||
| PR_HEAD_REF: ${{ github.event.pull_request.head.ref }} | ||
| run: | | ||
| python -m tools.pr_preflight_launcher --ai-backend claude --output-dir "${CLAUDE_OUTPUT_DIR}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
style: missingPR_BASE_SHA environment variable -pr_preflight_launcher.py:52 expects eitherPR_BASE_SHA orPR_BASE_REF to be set, but onlyPR_BASE_REF is provided, so the workflow will attempt to resolve it viagit rev-parse origin/{base.ref} which requiresfetch-depth: 0
| -name:Run Claude Code via wrapper | |
| env: | |
| ANTHROPIC_API_KEY:${{ secrets.ANTHROPIC_API_KEY }} | |
| ANTHROPIC_BASE_URL:http://localhost:3456 | |
| PR_NUMBER:${{ github.event.pull_request.number }} | |
| PR_SHA:${{ github.event.pull_request.head.sha }} | |
| PR_BASE_REF:${{ github.event.pull_request.base.ref }} | |
| PR_HEAD_REF:${{ github.event.pull_request.head.ref }} | |
| run:| | |
| python -m tools.pr_preflight_launcher --ai-backend claude --output-dir "${CLAUDE_OUTPUT_DIR}" | |
| env: | |
| ANTHROPIC_API_KEY:${{ secrets.ANTHROPIC_API_KEY }} | |
| ANTHROPIC_BASE_URL:http://localhost:3456 | |
| PR_NUMBER:${{ github.event.pull_request.number }} | |
| PR_SHA:${{ github.event.pull_request.head.sha }} | |
| PR_BASE_SHA:${{ github.event.pull_request.base.sha }} | |
| PR_BASE_REF:${{ github.event.pull_request.base.ref }} | |
| PR_HEAD_REF:${{ github.event.pull_request.head.ref }} |
| - name: Run Gemini PR review | ||
| env: | ||
| #GEMINI_MODEL: gemini-1.5-flash-latest | ||
| GEMINI_OUTPUT_DIR: artifacts/gemini_review/${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.sha }} | ||
| GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }} | ||
| PR_NUMBER: ${{ github.event.pull_request.number }} | ||
| PR_SHA: ${{ github.event.pull_request.head.sha }} | ||
| PR_BASE_REF: ${{ github.event.pull_request.base.ref }} | ||
| PR_HEAD_REF: ${{ github.event.pull_request.head.ref }} | ||
| run: | | ||
| python -m tools.pr_preflight_launcher --ai-backend gemini --output-dir "${GEMINI_OUTPUT_DIR}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
style: missingPR_BASE_SHA environment variable -pr_preflight_launcher.py:52 expects eitherPR_BASE_SHA orPR_BASE_REF to be set, but onlyPR_BASE_REF is provided, so the workflow will attempt to resolve it viagit rev-parse origin/{base.ref} which requiresfetch-depth: 0
| -name:Run Gemini PR review | |
| env: | |
| #GEMINI_MODEL: gemini-1.5-flash-latest | |
| GEMINI_OUTPUT_DIR:artifacts/gemini_review/${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.sha }} | |
| GEMINI_API_KEY:${{ secrets.GEMINI_API_KEY }} | |
| PR_NUMBER:${{ github.event.pull_request.number }} | |
| PR_SHA:${{ github.event.pull_request.head.sha }} | |
| PR_BASE_REF:${{ github.event.pull_request.base.ref }} | |
| PR_HEAD_REF:${{ github.event.pull_request.head.ref }} | |
| run:| | |
| python -m tools.pr_preflight_launcher --ai-backend gemini --output-dir "${GEMINI_OUTPUT_DIR}" | |
| -name:Run Gemini PR review | |
| env: | |
| #GEMINI_MODEL: gemini-1.5-flash-latest | |
| GEMINI_OUTPUT_DIR:artifacts/gemini_review/${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.sha }} | |
| GEMINI_API_KEY:${{ secrets.GEMINI_API_KEY }} | |
| PR_NUMBER:${{ github.event.pull_request.number }} | |
| PR_SHA:${{ github.event.pull_request.head.sha }} | |
| PR_BASE_SHA:${{ github.event.pull_request.base.sha }} | |
| PR_BASE_REF:${{ github.event.pull_request.base.ref }} | |
| PR_HEAD_REF:${{ github.event.pull_request.head.ref }} |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
11 files reviewed, no comments
Edit Code Review Agent Settings |Greptile
React with 👍 or 👎 to share your feedback on this new summary format
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
11 files reviewed, no comments
Edit Code Review Agent Settings |Greptile
React with 👍 or 👎 to share your feedback on this new summary format
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
11 files reviewed, no comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
11 files reviewed, no comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
11 files reviewed, 3 comments
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
🤖 Gemini PR ReviewCommit:4137af0 Comparing This pull request introduces a new CI workflow to automatically review pull requests using AI models (Gemini and Claude). The changes consist of new GitHub Actions workflows, Python scripts to drive the AI CLI tools, and a Docker setup for testing. Code Quality and StyleThe code is well-structured and follows good practices. The Python scripts are modular, with clear responsibilities for handling Git operations, wrapping the AI CLIs, and launching the review process. The code is readable, well-documented with docstrings and comments, and uses type hints. The GitHub Actions workflows are well-organized, using environment variables for configuration and secrets. The shell scripts are simple and serve their purpose. Test CoverageWhile there are no formal unit tests for the Python scripts, the pull request includes a Docker setup for testing the entire workflow in an isolated environment. This allows for integration testing of the scripts and the AI CLI tools. The inclusion of a DocumentationThe code is well-documented. The Python scripts have docstrings explaining the purpose of each module and function, as well as the meaning of different exit codes. The command-line arguments for the launcher script are also well-described. The GitHub Actions workflows contain comments that clarify the purpose of each step. Potential Bugs or Issues
ConclusionThis pull request is a well-engineered solution for automating pull request reviews using AI. The code is of high quality, the testing strategy is practical, and the documentation is clear. The only minor issue is the incomplete implementation of the Claude review posting, but the Gemini workflow is complete and provides a solid foundation. The addition of this automated review system has the potential to significantly improve the development workflow. VERDICT: PASSED Review generated at 2025-11-20T21:31:49.715Z |
This update supports Gemini (tested) and Claude (untested)