mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-11 12:09:03 +00:00
89 lines
2.5 KiB
YAML
89 lines
2.5 KiB
YAML
name: AI Code Review
|
|
|
|
on:
|
|
pull_request_target:
|
|
types: [opened, reopened, synchronize, ready_for_review]
|
|
issue_comment:
|
|
types: [created]
|
|
workflow_dispatch:
|
|
inputs:
|
|
pr_number:
|
|
description: PR number to review
|
|
required: true
|
|
type: string
|
|
|
|
concurrency:
|
|
group: >-
|
|
pr-agent-${{
|
|
github.event.pull_request.number ||
|
|
github.event.issue.number ||
|
|
github.event.inputs.pr_number ||
|
|
github.run_id
|
|
}}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
dispatch-review:
|
|
name: Queue /review comment
|
|
if: github.event_name == 'workflow_dispatch'
|
|
runs-on: [self-hosted, cliproxy]
|
|
permissions:
|
|
issues: write
|
|
|
|
steps:
|
|
- name: Post /review command to the PR
|
|
uses: actions/github-script@v7
|
|
env:
|
|
PR_NUMBER: ${{ github.event.inputs.pr_number }}
|
|
with:
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
script: |
|
|
const issue_number = Number(process.env.PR_NUMBER);
|
|
if (!Number.isInteger(issue_number) || issue_number <= 0) {
|
|
core.setFailed(`Invalid PR number: ${process.env.PR_NUMBER}`);
|
|
return;
|
|
}
|
|
|
|
await github.rest.issues.createComment({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
issue_number,
|
|
body: '/review',
|
|
});
|
|
|
|
pr-agent:
|
|
name: PR-Agent Review
|
|
if: >-
|
|
github.event_name != 'workflow_dispatch' &&
|
|
(
|
|
github.event_name == 'pull_request_target' ||
|
|
(
|
|
github.event_name == 'issue_comment' &&
|
|
github.event.issue.pull_request &&
|
|
github.event.comment.body == '/review' &&
|
|
(
|
|
contains(fromJSON('["COLLABORATOR","MEMBER","OWNER"]'), github.event.comment.author_association) ||
|
|
github.event.sender.login == 'github-actions[bot]'
|
|
)
|
|
)
|
|
)
|
|
runs-on: [self-hosted, cliproxy]
|
|
timeout-minutes: 20
|
|
permissions:
|
|
issues: write
|
|
pull-requests: write
|
|
contents: read
|
|
env:
|
|
GITHUB_TOKEN: ${{ github.token }}
|
|
OPENAI_KEY: ${{ secrets.CLIPROXY_API_KEY }}
|
|
"OPENAI.API_BASE": http://127.0.0.1:8317/v1
|
|
"config.model": "gpt-5.4-mini"
|
|
"config.fallback_models": '["gpt-5.4-mini"]'
|
|
"github_action_config.auto_review": "true"
|
|
"github_action_config.auto_describe": "false"
|
|
"github_action_config.auto_improve": "false"
|
|
|
|
steps:
|
|
- name: Run PR-Agent
|
|
uses: qodo-ai/pr-agent@v0.34
|