diff --git a/.github/workflows/ai-review.yml b/.github/workflows/ai-review.yml index f05531518..a9e7b1629 100644 --- a/.github/workflows/ai-review.yml +++ b/.github/workflows/ai-review.yml @@ -2,14 +2,18 @@ # # Triggers: # - Automatically on PR open/ready_for_review -# - On-demand via PR comments: /kimi, /codex, /claude (requires write access) +# - On-demand via PR comments (requires write access): +# /review for every reviewer below, or /kimi, /codex, /claude, /deepseek, /gemini, /grok for one # -# Custom prompt: .github/prompts/ai-review.md +# Custom prompt: .github/prompts/ai-review.md (read from the PR's base branch) # -# Required secrets: -# - KIMI_API_KEY: For Kimi reviews (https://platform.moonshot.ai/) +# Required secrets (a reviewer whose secret is missing comments and fails its check): +# - KIMI_API_KEY: For Kimi reviews (https://platform.kimi.ai/) # - OPENAI_API_KEY: For Codex reviews (https://platform.openai.com/) # - ANTHROPIC_API_KEY: For Claude reviews (https://console.anthropic.com/) +# - DEEPSEEK_API_KEY: For DeepSeek reviews (https://platform.deepseek.com/) +# - GEMINI_API_KEY: For Gemini reviews (https://aistudio.google.com/apikey) +# - XAI_API_KEY: For Grok reviews (https://console.x.ai/) name: AI Code Review @@ -19,21 +23,61 @@ on: issue_comment: types: [created] +permissions: + contents: read + pull-requests: write + jobs: kimi-review: - if: github.event_name == 'issue_comment' || github.event.pull_request.draft == false - uses: lambdaclass/actions/.github/workflows/ai-review-kimi.yml@212745563f1482299f563a3eb97909953df2a201 # v1 + if: > + (github.event_name == 'pull_request' && github.event.pull_request.draft == false) || + (github.event_name == 'issue_comment' && + (startsWith(github.event.comment.body, '/kimi') || startsWith(github.event.comment.body, '/review'))) + uses: lambdaclass/actions/.github/workflows/ai-review-kimi.yml@ad22254d36dc2038b846f82045d6b9d9fd7605aa # v1 secrets: KIMI_API_KEY: ${{ secrets.KIMI_API_KEY }} codex-review: - if: github.event_name == 'issue_comment' || github.event.pull_request.draft == false - uses: lambdaclass/actions/.github/workflows/ai-review-codex.yml@212745563f1482299f563a3eb97909953df2a201 # v1 + if: > + (github.event_name == 'pull_request' && github.event.pull_request.draft == false) || + (github.event_name == 'issue_comment' && + (startsWith(github.event.comment.body, '/codex') || startsWith(github.event.comment.body, '/review'))) + uses: lambdaclass/actions/.github/workflows/ai-review-codex.yml@ad22254d36dc2038b846f82045d6b9d9fd7605aa # v1 secrets: OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} claude-review: - if: github.event_name == 'issue_comment' || github.event.pull_request.draft == false - uses: lambdaclass/actions/.github/workflows/ai-review-claude.yml@212745563f1482299f563a3eb97909953df2a201 # v1 + if: > + (github.event_name == 'pull_request' && github.event.pull_request.draft == false) || + (github.event_name == 'issue_comment' && + (startsWith(github.event.comment.body, '/claude') || startsWith(github.event.comment.body, '/review'))) + uses: lambdaclass/actions/.github/workflows/ai-review-claude.yml@ad22254d36dc2038b846f82045d6b9d9fd7605aa # v1 secrets: ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} + + deepseek-review: + if: > + (github.event_name == 'pull_request' && github.event.pull_request.draft == false) || + (github.event_name == 'issue_comment' && + (startsWith(github.event.comment.body, '/deepseek') || startsWith(github.event.comment.body, '/review'))) + uses: lambdaclass/actions/.github/workflows/ai-review-deepseek.yml@ad22254d36dc2038b846f82045d6b9d9fd7605aa # v1 + secrets: + DEEPSEEK_API_KEY: ${{ secrets.DEEPSEEK_API_KEY }} + + gemini-review: + if: > + (github.event_name == 'pull_request' && github.event.pull_request.draft == false) || + (github.event_name == 'issue_comment' && + (startsWith(github.event.comment.body, '/gemini') || startsWith(github.event.comment.body, '/review'))) + uses: lambdaclass/actions/.github/workflows/ai-review-gemini.yml@ad22254d36dc2038b846f82045d6b9d9fd7605aa # v1 + secrets: + GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }} + + grok-review: + if: > + (github.event_name == 'pull_request' && github.event.pull_request.draft == false) || + (github.event_name == 'issue_comment' && + (startsWith(github.event.comment.body, '/grok') || startsWith(github.event.comment.body, '/review'))) + uses: lambdaclass/actions/.github/workflows/ai-review-grok.yml@ad22254d36dc2038b846f82045d6b9d9fd7605aa # v1 + secrets: + XAI_API_KEY: ${{ secrets.XAI_API_KEY }}