Skip to content

Commit

Permalink
Update ai-code-review.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
champ96k committed Sep 16, 2024
1 parent b9bb3f8 commit b574d22
Showing 1 changed file with 9 additions and 17 deletions.
26 changes: 9 additions & 17 deletions .github/workflows/ai-code-review.yaml
Original file line number Diff line number Diff line change
@@ -1,42 +1,34 @@
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
fetch-depth: 0

# Step 2: Set up environment variables
- name: Set up environment variables
run: |
echo "Setting up environment variables..."
echo "OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}" >> $GITHUB_ENV
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 }}

0 comments on commit b574d22

Please # to comment.