Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .github/workflows/ai-codereview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: AI Review

on:
pull_request:
types: [opened, synchronize]
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
issues:
types: [opened]

jobs:
ai-review:
if: |
github.event_name == 'pull_request' ||
(github.event_name == 'issue_comment' && (contains(github.event.comment.body, '@ai') || contains(github.event.comment.body, '/ai'))) ||
(github.event_name == 'pull_request_review_comment' && (contains(github.event.comment.body, '@ai') || contains(github.event.comment.body, '/ai'))) ||
(github.event_name == 'issues' && (contains(github.event.issue.body, '@ai') || contains(github.event.issue.body, '/ai')))
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
issues: write

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Checkout PR branch
if: github.event.issue.pull_request || github.event_name == 'pull_request'
run: |
if [ -n "${{ github.event.issue.pull_request }}" ]; then
PR_BRANCH=$(gh pr view ${{ github.event.issue.number }} --json headRefName --jq '.headRefName')
git fetch origin "$PR_BRANCH"
git checkout "$PR_BRANCH"
fi
env:
GH_TOKEN: ${{ github.token }}

- name: Run AI Agent
uses: nadimtuhin/ai-code-action@main
with:
api_url: ${{ secrets.AI_API_URL }}
api_key: ${{ secrets.AI_API_KEY }}
model: ${{ secrets.AI_MODEL }}
max_turns: 25
env:
GH_TOKEN: ${{ github.token }}
Loading