name: AI Code Review on: pull_request: types: [opened, synchronize] jobs: ai-review: runs-on: ubuntu-latest steps: # Checkout the PR repository - uses: actions/checkout@v4 with: fetch-depth: 0 # Checkout the AI tooling from this repo's tools directory - name: Setup AI Review Tools run: | # Tools are already in this repo under tools/ai-review echo "AI Review tools available at tools/ai-review" # Setup Python - uses: actions/setup-python@v5 with: python-version: "3.11" # Install dependencies - run: pip install requests pyyaml # Run the AI review - name: Run AI Review env: AI_REVIEW_TOKEN: ${{ secrets.GITHUB_TOKEN }} AI_REVIEW_REPO: ${{ github.repository }} AI_REVIEW_API_URL: https://api.github.com AI_REVIEW_PR_NUMBER: ${{ github.event.pull_request.number }} OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }} OLLAMA_HOST: ${{ secrets.OLLAMA_HOST }} run: | cd tools/ai-review python main.py pr ${{ github.repository }} ${{ github.event.pull_request.number }} \ --title "${{ github.event.pull_request.title }}" # Fail CI on HIGH severity (optional) - name: Check Review Result if: failure() run: | echo "AI Review found HIGH severity issues. Please address them before merging." exit 1