-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (40 loc) · 1.4 KB
/
ai-code-review.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
name: AI Code Reviewer
on:
pull_request:
types:
- opened
- synchronize
- reopened
jobs:
ai-code-review:
runs-on: ubuntu-latest
permissions:
pull-requests: write # Allow write access to PRs
steps:
# Step 1: Check out the pull request code
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0 # Fetches the entire history for the repository
# Step 2: Set up environment variables
- name: Set up environment variables
run: |
echo "GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV
echo "GITHUB_REPO=${{ github.repository }}" >> $GITHUB_ENV
echo "PR_NUMBER=${{ github.event.pull_request.number }}" >> $GITHUB_ENV
# Step 3: Install jq for JSON parsing
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y jq
# Step 4: Grant execute permission
- name: Grant execute permission to the script
run: chmod +x ./scripts/run_code_reviewer.sh
# Step 5: Run the AI code reviewer
- name: Run AI Code Reviewer
run: ./scripts/run_code_reviewer.sh
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPO: ${{ github.repository }}
PR_NUMBER: ${{ github.event.pull_request.number }}