deps(android-legacy): bump gradle-wrapper from 9.4.1 to 9.5.0 in /android-legacy #66
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Jules (Google Labs AI Review) | |
| on: | |
| pull_request: | |
| types: [ opened, synchronize, reopened ] | |
| branches: [ main, develop ] | |
| issue_comment: | |
| types: [ created ] | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| issues: write | |
| jobs: | |
| jules-review: | |
| name: Jules AI Code Review | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| if: | | |
| github.event_name == 'pull_request' || | |
| (github.event_name == 'issue_comment' && | |
| github.event.issue.pull_request != null && | |
| contains(github.event.comment.body, '/jules')) | |
| steps: | |
| - name: Checkout PR | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| ref: ${{ github.event.pull_request.head.sha || github.sha }} | |
| - name: Collect changed files | |
| id: changed | |
| run: | | |
| BASE=${{ github.event.pull_request.base.sha || 'HEAD~1' }} | |
| HEAD=${{ github.event.pull_request.head.sha || 'HEAD' }} | |
| git diff --name-only "$BASE" "$HEAD" > changed_files.txt | |
| echo "changed_count=$(wc -l < changed_files.txt)" >> $GITHUB_OUTPUT | |
| cat changed_files.txt | |
| - name: Run Jules AI Analysis | |
| id: jules | |
| env: | |
| JULES_API_KEY: ${{ secrets.JULES_API_KEY }} | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| PR_NUMBER: ${{ github.event.pull_request.number }} | |
| REPO: ${{ github.repository }} | |
| run: | | |
| if [ -z "$JULES_API_KEY" ]; then | |
| echo "jules_available=false" >> $GITHUB_OUTPUT | |
| echo "Jules API key not configured — skipping AI review." | |
| exit 0 | |
| fi | |
| DIFF=$(git diff \ | |
| ${{ github.event.pull_request.base.sha || 'HEAD~1' }} \ | |
| ${{ github.event.pull_request.head.sha || 'HEAD' }} \ | |
| -- '*.java' '*.kt' '*.swift' '*.m' '*.h' '*.c' '*.cpp' \ | |
| | head -c 20000) | |
| PAYLOAD=$(jq -n \ | |
| --arg diff "$DIFF" \ | |
| --arg repo "$REPO" \ | |
| --arg pr "$PR_NUMBER" \ | |
| '{ | |
| "repository": $repo, | |
| "pull_request": $pr, | |
| "diff": $diff, | |
| "focus": ["security","performance","correctness","style"] | |
| }') | |
| curl -s -X POST "https://jules.google.com/api/v1/review" \ | |
| -H "Authorization: Bearer $JULES_API_KEY" \ | |
| -H "Content-Type: application/json" \ | |
| -d "$PAYLOAD" > jules_response.json || true | |
| echo "jules_available=true" >> $GITHUB_OUTPUT | |
| - name: Post Jules comment | |
| if: steps.jules.outputs.jules_available == 'true' | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| PR_NUMBER: ${{ github.event.pull_request.number }} | |
| run: | | |
| SUMMARY=$(jq -r '.summary // "No summary returned."' jules_response.json) | |
| ISSUES=$(jq -r '.issues[]? | "- **\(.severity)** [\(.file):\(.line)]: \(.message)"' jules_response.json || echo "None reported.") | |
| BODY="### 🤖 Jules AI Code Review\n\n**Summary:**\n$SUMMARY\n\n**Issues Found:**\n$ISSUES\n\n---\n*Automated review by [Jules](https://jules.google.com) — Google Labs AI assistant.*" | |
| gh pr comment "$PR_NUMBER" --body "$(echo -e "$BODY")" | |
| - name: Fail on critical Jules issues | |
| if: steps.jules.outputs.jules_available == 'true' | |
| run: | | |
| CRITICAL=$(jq '[.issues[]? | select(.severity == "critical")] | length' jules_response.json 2>/dev/null || echo "0") | |
| if [ "$CRITICAL" -gt 0 ]; then | |
| echo "Jules found $CRITICAL critical issue(s). Please resolve them before merging." | |
| exit 1 | |
| fi |