Skip to content

Update models.py

Update models.py #35

name: Автоматическое ревью PR с Mistral AI
on:
pull_request:
types: [opened, synchronize]
branches:
- main
jobs:
code_review:
runs-on: ubuntu-latest
name: Mistral AI Code Review
permissions:
contents: read
pull-requests: write
steps:
- name: Debug Trigger Event
run: |
echo "Event name: ${{ github.event_name }}"
echo "Event action: ${{ github.event.action }}"
echo "PR number: ${{ github.event.pull_request.number }}"
echo "Base branch: ${{ github.event.pull_request.base.ref }}"
echo "Head branch: ${{ github.event.pull_request.head.ref }}"
echo "Base SHA: ${{ github.event.pull_request.base.sha }}"
echo "Head SHA: ${{ github.event.pull_request.head.sha }}"
- name: Checkout Repository
uses: actions/checkout@v3
with:
fetch-depth: 0 # Получаем полную историю для сравнения изменений
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install requests mistralai==0.4.2
- name: Check for MISTRAL_API_KEY
run: |
if [ -z "${{ secrets.MISTRAL_API_KEY }}" ]; then
echo "⚠️ MISTRAL_API_KEY is not set or empty"
exit 1
else
echo "✅ MISTRAL_API_KEY is set"
fi
- name: Mistral AI Code Review
run: python .github/workflows/review_code.py
env:
MISTRAL_API_KEY: ${{ secrets.MISTRAL_API_KEY }}
PR_NUMBER: ${{ github.event.pull_request.number }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
GITHUB_REPOSITORY: ${{ github.repository }}