69 lines
2.3 KiB
YAML
69 lines
2.3 KiB
YAML
name: AI PR Review
|
|
description: Automated AI-powered PR code review using any OpenAI-compatible endpoint
|
|
|
|
inputs:
|
|
api_url:
|
|
description: Base URL of the OpenAI-compatible API endpoint (e.g. https://api.openai.com/v1)
|
|
required: true
|
|
api_key:
|
|
description: API key for the endpoint
|
|
required: true
|
|
model:
|
|
description: Model identifier to use for the review
|
|
required: false
|
|
default: openai/gpt-oss-120b
|
|
github_token:
|
|
description: Token used to post the review comment and fetch PR comments
|
|
required: false
|
|
default: ${{ github.token }}
|
|
|
|
runs:
|
|
using: composite
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Fetch previous review context
|
|
id: context
|
|
shell: bash
|
|
env:
|
|
GITEA_TOKEN: ${{ inputs.github_token }}
|
|
GITEA_SERVER_URL: ${{ github.server_url }}
|
|
REPO: ${{ github.repository }}
|
|
PR_NUMBER: ${{ github.event.pull_request.number }}
|
|
run: bash "${{ github.action_path }}/scripts/fetch-context.sh"
|
|
|
|
- name: Generate diff
|
|
id: diff
|
|
shell: bash
|
|
env:
|
|
PREV_SHA: ${{ steps.context.outputs.prev_sha }}
|
|
run: bash "${{ github.action_path }}/scripts/generate-diff.sh"
|
|
|
|
- name: Run AI review
|
|
id: ai_review
|
|
shell: bash
|
|
env:
|
|
AI_API_URL: ${{ inputs.api_url }}
|
|
AI_API_KEY: ${{ inputs.api_key }}
|
|
AI_MODEL: ${{ inputs.model }}
|
|
PR_TITLE: ${{ github.event.pull_request.title }}
|
|
PR_BODY: ${{ github.event.pull_request.body }}
|
|
PREV_REVIEW: ${{ steps.context.outputs.prev_review }}
|
|
INCREMENTAL: ${{ steps.diff.outputs.incremental }}
|
|
run: bash "${{ github.action_path }}/scripts/run-review.sh"
|
|
|
|
- name: Post review comment
|
|
shell: bash
|
|
env:
|
|
GITEA_TOKEN: ${{ inputs.github_token }}
|
|
GITEA_SERVER_URL: ${{ github.server_url }}
|
|
REPO: ${{ github.repository }}
|
|
PR_NUMBER: ${{ github.event.pull_request.number }}
|
|
REVIEW: ${{ steps.ai_review.outputs.review }}
|
|
CURRENT_SHA: ${{ github.event.pull_request.head.sha }}
|
|
TRUNCATED: ${{ steps.diff.outputs.truncated }}
|
|
INCREMENTAL: ${{ steps.diff.outputs.incremental }}
|
|
run: bash "${{ github.action_path }}/scripts/post-comment.sh"
|