Skip to main content

PR Review Bot

Automatically review pull requests with AI when they’re opened or updated.

Setup

  1. Add KYMA_API_KEY as a repository secret (Settings > Secrets > Actions)
  2. Create .github/workflows/ai-review.yml:
name: AI Code Review
on:
  pull_request:
    types: [opened, synchronize]

jobs:
  review:
    runs-on: ubuntu-latest
    permissions:
      pull-requests: write
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Get diff
        run: git diff origin/${{ github.base_ref }}...HEAD > diff.txt

      - name: AI Review
        env:
          KYMA_API_KEY: ${{ secrets.KYMA_API_KEY }}
        run: |
          REVIEW=$(curl -s https://kymaapi.com/v1/chat/completions \
            -H "Authorization: Bearer $KYMA_API_KEY" \
            -H "Content-Type: application/json" \
            -d "{
              \"model\": \"deepseek-v3\",
              \"messages\": [{
                \"role\": \"system\",
                \"content\": \"You are a senior code reviewer. Be concise. Focus on bugs, security issues, and improvements.\"
              }, {
                \"role\": \"user\",
                \"content\": \"Review this diff:\\n$(cat diff.txt | head -c 8000)\"
              }]
            }" | jq -r '.choices[0].message.content')

          gh pr comment ${{ github.event.pull_request.number }} \
            --body "## AI Code Review\n\n$REVIEW\n\n---\n*Powered by [Kyma API](https://kymaapi.com) — deepseek-v3*"
        env:
          GH_TOKEN: ${{ github.token }}
          KYMA_API_KEY: ${{ secrets.KYMA_API_KEY }}

Changelog Generator

Generate release notes from commits:
name: Generate Changelog
on:
  release:
    types: [created]

jobs:
  changelog:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Generate changelog
        env:
          KYMA_API_KEY: ${{ secrets.KYMA_API_KEY }}
        run: |
          COMMITS=$(git log --oneline $(git describe --tags --abbrev=0 HEAD^)..HEAD)
          CHANGELOG=$(curl -s https://kymaapi.com/v1/chat/completions \
            -H "Authorization: Bearer $KYMA_API_KEY" \
            -H "Content-Type: application/json" \
            -d "{
              \"model\": \"qwen-3.6-plus\",
              \"messages\": [{
                \"role\": \"user\",
                \"content\": \"Write concise release notes from these commits:\\n$COMMITS\"
              }]
            }" | jq -r '.choices[0].message.content')
          echo "$CHANGELOG"
Use CaseModelWhy
Code reviewdeepseek-v3Best value, strong code understanding
Changelogqwen-3.6-plusBest overall quality
Quick checksqwen-3-32bFastest response
Keep diffs under 8,000 characters to stay within model context limits. For large PRs, review file-by-file.