name: 'Evals: PR Impact' on: pull_request: paths: - 'packages/core/src/prompts/**' - 'packages/core/src/tools/**' - 'packages/core/src/agents/**' - 'evals/**' permissions: contents: 'read' checks: 'write' pull-requests: 'write' jobs: eval-run: name: 'Eval Run (${{ matrix.model }}, attempt ${{ matrix.run_attempt }})' runs-on: 'gemini-cli-ubuntu-16-core' if: "github.repository == 'google-gemini/gemini-cli'" strategy: fail-fast: false matrix: run_attempt: [1, 2, 3] model: ["gemini-3.1-pro-preview-customtools", "gemini-3-flash-preview"] steps: - name: 'Checkout' uses: 'actions/checkout@v4' - name: 'Set up Node.js' uses: 'actions/setup-node@v4' with: node-version-file: '.nvmrc' cache: 'npm' - name: 'Install dependencies' run: 'npm ci' - name: 'Build project' run: 'npm run build' - name: 'Run Evals' env: GEMINI_API_KEY: '${{ secrets.GEMINI_API_KEY }}' RUN_EVALS: 'true' GEMINI_MODEL: '${{ matrix.model }}' run: | # Use a unique directory name for this matrix leg DIR_NAME="eval-logs-${{ matrix.model }}-${{ matrix.run_attempt }}" mkdir -p "evals/logs/$DIR_NAME" npm run test:all_evals -- --outputFile.json="evals/logs/$DIR_NAME/report.json" || true - name: 'Upload Logs' uses: 'actions/upload-artifact@v4' with: name: 'eval-logs-${{ matrix.model }}-${{ matrix.run_attempt }}' path: 'evals/logs' retention-days: 1 aggregate-impact: name: 'Aggregate Impact' needs: ['eval-run'] if: 'always()' runs-on: 'gemini-cli-ubuntu-16-core' steps: - name: 'Checkout' uses: 'actions/checkout@v4' - name: 'Download Logs' uses: 'actions/download-artifact@v4' with: path: 'artifacts' - name: 'Generate Impact Report' id: 'generate-report' env: GH_TOKEN: '${{ secrets.GITHUB_TOKEN }}' run: | if [ ! -d "artifacts" ]; then echo "No logs found, skipping report generation." exit 0 fi echo "" > report.md node scripts/aggregate_evals.js artifacts --compare-main --pr-comment >> report.md cat report.md >> "$GITHUB_STEP_SUMMARY" - name: 'Comment on PR' env: GH_TOKEN: '${{ secrets.GITHUB_TOKEN }}' run: | if [ ! -f "report.md" ]; then exit 0 fi PR_NUMBER=${{ github.event.pull_request.number }} EXISTING_COMMENT=$(gh pr view $PR_NUMBER --json comments --jq '.comments[] | select(.body | contains("eval-impact-report")) | .id' | head -n 1) if [ -n "$EXISTING_COMMENT" ]; then gh pr comment $PR_NUMBER --body-file report.md else gh pr comment $PR_NUMBER --body-file report.md fi