30 lines
935 B
YAML
30 lines
935 B
YAML
name: AI Pull Request Review
|
|
|
|
on:
|
|
pull_request:
|
|
types: [opened, reopened, synchronize]
|
|
|
|
jobs:
|
|
review:
|
|
name: Review changed code
|
|
runs-on: ubuntu-latest
|
|
# Never expose repository secrets to pull requests from forks.
|
|
if: ${{ gitea.event.pull_request.head.repo.full_name == gitea.repository }}
|
|
steps:
|
|
- name: Check out the trusted reviewer from the target revision
|
|
uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ gitea.event.pull_request.base.sha }}
|
|
fetch-depth: 0
|
|
path: trusted
|
|
|
|
- name: Run AI review
|
|
working-directory: trusted
|
|
env:
|
|
GITEA_TOKEN: ${{ secrets.AI_REVIEW_GITEA_TOKEN }}
|
|
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
|
OPENAI_MODEL: ${{ secrets.OPENAI_MODEL }}
|
|
OPENAI_BASE_URL: ${{ secrets.OPENAI_BASE_URL }}
|
|
AI_MAX_DIFF_CHARS: "80000"
|
|
run: node .gitea/scripts/ai-review.mjs
|