ai review test #30
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: AI Code Review on PR | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
permissions: | |
contents: read | |
pull-requests: write | |
jobs: | |
AI-Review: | |
runs-on: ubuntu-latest | |
steps: | |
- name: ✅ Checkout PR code | |
uses: actions/checkout@v3 | |
- name: 🔍 Debug workspace structure | |
run: ls -R .github | |
- name: 🐍 Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: 📦 Install dependencies | |
run: pip install openai requests | |
- name: 🧾 Download PR diff via GitHub API | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GITHUB_REPOSITORY: ${{ github.repository }} | |
PR_NUMBER: ${{ github.event.pull_request.number }} | |
run: | | |
curl -s -H "Authorization: token $GITHUB_TOKEN" \ | |
-H "Accept: application/vnd.github.v3.diff" \ | |
https://api.github.com/repos/$GITHUB_REPOSITORY/pulls/$PR_NUMBER \ | |
-o pr.diff | |
- name: 🤖 Run AI code review | |
env: | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GITHUB_REPOSITORY: ${{ github.repository }} | |
PR_NUMBER: ${{ github.event.pull_request.number }} | |
run: python .github/scripts/ai_code_review.py |