-
Notifications
You must be signed in to change notification settings - Fork 78
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 our terms of service and privacy 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?
Changes from 1 commit
1a50f38
37a731c
22cb219
3644583
71b2dc7
02460be
4137af0
29f6006
0f1cbdb
9a1badf
647f39f
bfed112
bb2ccbb
540bffd
9439709
da4516a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,131 @@ | ||||||||||||||||||||||||||||||||||||||
| # SPDX-FileCopyrightText: Copyright (c) 2023-present NVIDIA CORPORATION & AFFILIATES. | ||||||||||||||||||||||||||||||||||||||
| # All rights reserved. | ||||||||||||||||||||||||||||||||||||||
| # SPDX-License-Identifier: BSD-3-Clause | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| name: Claude CLI PR Review | ||||||||||||||||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||||||||||||||||
| pull_request: | ||||||||||||||||||||||||||||||||||||||
| types: [opened, synchronize, ready_for_review] | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| concurrency: | ||||||||||||||||||||||||||||||||||||||
| group: ${{ github.workflow }}-${{ github.event.pull_request.number }} | ||||||||||||||||||||||||||||||||||||||
| cancel-in-progress: true | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| run-name: Claude review for PR ${{ github.event.pull_request.number }} - ${{ github.event.pull_request.head.sha }} | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||||||||||||||
| claude-code-review: | ||||||||||||||||||||||||||||||||||||||
| name: Run Claude Code Review | ||||||||||||||||||||||||||||||||||||||
| # Skip if PR is in draft | ||||||||||||||||||||||||||||||||||||||
| if: github.event.pull_request.draft == false | ||||||||||||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||||||||||||||||
| permissions: | ||||||||||||||||||||||||||||||||||||||
| pull-requests: write | ||||||||||||||||||||||||||||||||||||||
| contents: read | ||||||||||||||||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||||||||||||||||
| CLAUDE_OUTPUT_DIR: artifacts/claude_review/${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.sha }} | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||||||||
| - name: Checkout code | ||||||||||||||||||||||||||||||||||||||
| uses: actions/checkout@v4 | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| - name: Setup Node.js | ||||||||||||||||||||||||||||||||||||||
| uses: actions/setup-node@v4 | ||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||
| node-version: '20' | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| - name: Set up Python | ||||||||||||||||||||||||||||||||||||||
| uses: actions/setup-python@v4 | ||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||
| python-version: '3.10' | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| - name: Install Claude Code | ||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||
| npm install -g @anthropic-ai/claude-code | ||||||||||||||||||||||||||||||||||||||
| echo "$(npm config get prefix)/bin" >> $GITHUB_PATH | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| - name: Install Claude Code Router | ||||||||||||||||||||||||||||||||||||||
| run: npm install -g @musistudio/claude-code-router@1.0.66 | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| - name: Setup Claude Code Router config | ||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||
| mkdir -p $HOME/.claude-code-router | ||||||||||||||||||||||||||||||||||||||
| cat <<EOF > $HOME/.claude-code-router/config.json | ||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||
| "LOG": true, | ||||||||||||||||||||||||||||||||||||||
| "API_TIMEOUT_MS": 60000, | ||||||||||||||||||||||||||||||||||||||
| "NON_INTERACTIVE_MODE": true, | ||||||||||||||||||||||||||||||||||||||
| "Providers": [ | ||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||
| "name": "anthropic", | ||||||||||||||||||||||||||||||||||||||
| "api_base_url": "\$ANTHROPIC_BASE_URL", | ||||||||||||||||||||||||||||||||||||||
| "api_key": "\$ANTHROPIC_API_KEY", | ||||||||||||||||||||||||||||||||||||||
| "models": [ | ||||||||||||||||||||||||||||||||||||||
| "\$ANTHROPIC_LLM_MODEL" | ||||||||||||||||||||||||||||||||||||||
| ], | ||||||||||||||||||||||||||||||||||||||
| "transformer": { | ||||||||||||||||||||||||||||||||||||||
| "use": ["anthropic", "proxy-handler"] | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
| ], | ||||||||||||||||||||||||||||||||||||||
| "Router": { | ||||||||||||||||||||||||||||||||||||||
| "default": "anthropic,\$ANTHROPIC_LLM_MODEL" | ||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||
| "transformers": [ | ||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||
| "path": "$GITHUB_WORKSPACE/tools/proxy.js" | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
| ] | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
| EOF | ||||||||||||||||||||||||||||||||||||||
| shell: bash | ||||||||||||||||||||||||||||||||||||||
xwang233 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| - name: Start Claude Code Router background service | ||||||||||||||||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||||||||||||||||
| ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} | ||||||||||||||||||||||||||||||||||||||
| ANTHROPIC_BASE_URL: ${{ secrets.ANTHROPIC_BASE_URL }} | ||||||||||||||||||||||||||||||||||||||
| ANTHROPIC_LLM_MODEL: ${{ secrets.ANTHROPIC_LLM_MODEL }} | ||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||
| nohup ccr start & | ||||||||||||||||||||||||||||||||||||||
| sleep 5 # Give it some time to start | ||||||||||||||||||||||||||||||||||||||
| shell: bash | ||||||||||||||||||||||||||||||||||||||
xwang233 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| - name: Check Claude CLI availability | ||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||
| echo "PATH=$PATH" | ||||||||||||||||||||||||||||||||||||||
| which claude || echo "claude not found on PATH" | ||||||||||||||||||||||||||||||||||||||
| claude --version || true | ||||||||||||||||||||||||||||||||||||||
| echo "npm prefix bin: $(npm config get prefix)/bin" || true | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| - 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}" | ||||||||||||||||||||||||||||||||||||||
|
Comment on lines
83
to
95
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. style: missing
Suggested change
|
||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| - name: Print Claude error (if any) | ||||||||||||||||||||||||||||||||||||||
| if: always() | ||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||
| if [ -f "${{ env.CLAUDE_OUTPUT_DIR }}/error.txt" ]; then | ||||||||||||||||||||||||||||||||||||||
| echo "===== Claude error.txt =====" | ||||||||||||||||||||||||||||||||||||||
| sed -n '1,200p' "${{ env.CLAUDE_OUTPUT_DIR }}/error.txt" | ||||||||||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||||||||||
| echo "No error.txt found in ${{ env.CLAUDE_OUTPUT_DIR }}" | ||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| - name: Upload Claude review artifacts | ||||||||||||||||||||||||||||||||||||||
| if: always() | ||||||||||||||||||||||||||||||||||||||
| uses: actions/upload-artifact@v4 | ||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||
| name: claude-review-${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.sha }} | ||||||||||||||||||||||||||||||||||||||
| path: ${{ env.CLAUDE_OUTPUT_DIR }}/** | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| # TODO: Add step to post results to PR | ||||||||||||||||||||||||||||||||||||||
| # - name: Post results to PR | ||||||||||||||||||||||||||||||||||||||
| # run: | | ||||||||||||||||||||||||||||||||||||||
| # # Parse output and post to PR | ||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,85 @@ | ||||||||||||||||||||||||||||||||||||||||||||
| name: Gemini CLI PR Review | ||||||||||||||||||||||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||||||||||||||||||||||
| pull_request: | ||||||||||||||||||||||||||||||||||||||||||||
| types: [opened, synchronize, ready_for_review] | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| concurrency: | ||||||||||||||||||||||||||||||||||||||||||||
| group: ${{ github.workflow }}-${{ github.event.pull_request.number }} | ||||||||||||||||||||||||||||||||||||||||||||
| cancel-in-progress: true | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| run-name: Gemini review for PR ${{ github.event.pull_request.number }} - ${{ github.event.pull_request.head.sha }} | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||||||||||||||||||||
| gemini-pr-review: | ||||||||||||||||||||||||||||||||||||||||||||
| # Skip if PR is in draft | ||||||||||||||||||||||||||||||||||||||||||||
| if: github.event.pull_request.draft == false | ||||||||||||||||||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||||||||||||||||||||||
| permissions: | ||||||||||||||||||||||||||||||||||||||||||||
| contents: read | ||||||||||||||||||||||||||||||||||||||||||||
| pull-requests: write | ||||||||||||||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||||||||||||||
| - name: Checkout code | ||||||||||||||||||||||||||||||||||||||||||||
| uses: actions/checkout@v4 | ||||||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||||||
| fetch-depth: 0 | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| - name: Setup Node.js | ||||||||||||||||||||||||||||||||||||||||||||
| uses: actions/setup-node@v4 | ||||||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||||||
| node-version: '20' | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| - name: Install Gemini CLI | ||||||||||||||||||||||||||||||||||||||||||||
| shell: bash | ||||||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||||||
| npm install -g @google/gemini-cli@latest | ||||||||||||||||||||||||||||||||||||||||||||
| echo "$(npm config get prefix)/bin" >> $GITHUB_PATH | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| - name: Verify Gemini CLI | ||||||||||||||||||||||||||||||||||||||||||||
| shell: bash | ||||||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||||||
| which gemini | ||||||||||||||||||||||||||||||||||||||||||||
| gemini --version | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| - name: Set up Python | ||||||||||||||||||||||||||||||||||||||||||||
| uses: actions/setup-python@v4 | ||||||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||||||
| python-version: '3.10' | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| - name: Install/Upgrade Google Python Client | ||||||||||||||||||||||||||||||||||||||||||||
| shell: bash | ||||||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||||||
| python -m pip install --upgrade pip | ||||||||||||||||||||||||||||||||||||||||||||
| pip install --upgrade google-generativeai | ||||||||||||||||||||||||||||||||||||||||||||
| # If you have a requirements.txt file, you might use this instead: | ||||||||||||||||||||||||||||||||||||||||||||
| # pip install -r requirements.txt --upgrade | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| - 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}" | ||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
60
to
71
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. style: missing
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| - name: Print Gemini error (if any) | ||||||||||||||||||||||||||||||||||||||||||||
| if: always() | ||||||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||||||
| if [ -f "${{ env.GEMINI_OUTPUT_DIR }}/error.txt" ]; then | ||||||||||||||||||||||||||||||||||||||||||||
| echo "===== Gemini error.txt =====" | ||||||||||||||||||||||||||||||||||||||||||||
| sed -n '1,200p' "${{ env.GEMINI_OUTPUT_DIR }}/error.txt" | ||||||||||||||||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||||||||||||||||
| echo "No error.txt found in ${{ env.GEMINI_OUTPUT_DIR }}" | ||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| - name: Upload Gemini review artifacts | ||||||||||||||||||||||||||||||||||||||||||||
| if: always() | ||||||||||||||||||||||||||||||||||||||||||||
| uses: actions/upload-artifact@v4 | ||||||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||||||
| name: gemini-review-${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.sha }} | ||||||||||||||||||||||||||||||||||||||||||||
| path: ${{ env.GEMINI_OUTPUT_DIR }}/** | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
xwang233 marked this conversation as resolved.
Show resolved
Hide resolved
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. syntax: file ends with blank lines after closing brace - syntax error leaves JavaScript incomplete
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
| "action": "opened", | ||
| "pull_request": { | ||
| "draft": false, | ||
| "number": 5489, | ||
| "head": { "sha": "9f9a6b2f91519b3dc02fe7ec7a5f2a3b98398338", "ref": "feature/branch" }, | ||
| "base": { "sha": "f8b8551a720cd5c3a9aa8950e5a50fb7d420cbe5", "ref": "main" } | ||
| } | ||
| } | ||
|
|
||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| # start from the official, clean Node.js 20 image (Debian-based) | ||
| # Gemini seems to go haywire with older node versions (e.g. 18) | ||
| FROM node:20 | ||
|
|
||
| COPY pr_preflight_launcher.py /usr/local/bin/ | ||
| COPY utils.py /usr/local/bin/tools/ | ||
| COPY git_helpers.py /usr/local/bin/tools/ | ||
| COPY ai_cli_wrapper.py /usr/local/bin/tools/ | ||
mattwalsh marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| # Add Python 3 and vim | ||
| RUN apt-get update && apt-get install -y python3 python3-pip vim | ||
|
|
||
| # Install the latest Gemini CLI globally inside the container | ||
| RUN npm install -g @google/gemini-cli --no-update-notifier | ||
|
|
||
| RUN node -v | ||
| RUN python3 --version | ||
| RUN gemini --version | ||
|
|
||
| # 5. Set a working directory (good practice) | ||
| WORKDIR /app | ||
|
|
||
| # 6. Set the default command. When the container starts, | ||
| # it will just run "bash", giving you an interactive shell. | ||
| CMD ["/bin/bash"] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| # run me from the 'ai_cli_docker_test' directory | ||
|
|
||
| (cd .. && docker build -f ai_cli_docker_test/Dockerfile -t ai_cli_docker_test_shell .) |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -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 | ||||||
|
||||||
| # 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 |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,115 @@ | ||||||
| #!/usr/bin/env python3 | ||||||
| """ | ||||||
| Core Wrapper script for running Gemini or Claude CLI in CI. | ||||||
| Accepts a prompt string, expected verdict marker, and output directory path. | ||||||
|
|
||||||
| Exit codes: | ||||||
| 0 - Success (CLI ran, verdict was PASSED) | ||||||
| 1 - Network/timeout errors, 'gemini' command not found, or unexpected error | ||||||
| 2 - API errors (rate limits, etc.) [best-effort; CLI may not distinguish] | ||||||
| 3 - Review Failed (CLI ran, verdict was FAILED) | ||||||
| 4 - Parsing Error (CLI ran, but the required verdict marker was missing or ambiguous) | ||||||
| """ | ||||||
|
|
||||||
| import subprocess | ||||||
| from pathlib import Path | ||||||
| from tools.utils import ensure_dir, write_to_path | ||||||
|
|
||||||
|
|
||||||
| def launch_ai_cli( | ||||||
| prompt: str, | ||||||
| tool: None, | ||||||
|
||||||
| tool: None, | |
| tool: str | None, |
Outdated
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)") |
Outdated
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" |
Outdated
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?" |
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: missing
fetch-depth: 0- without full git history,git merge-baseinpr_preflight_launcher.py:85will fail when computing the merge base between branches