Update pr-review.yml

revert files
This commit is contained in:
Anonymous
2026-03-20 12:35:49 +08:00
committed by GitHub
parent c42c9db72f
commit c2d3a19c26

View File

@@ -4,18 +4,26 @@
name: PR Review
on:
pull_request:
pull_request_target:
types: [opened, synchronize, reopened]
paths:
- '**.py'
- '**.html'
- '**.md'
- '**.ts'
- '**.tsx'
- 'docs/**'
- 'README.md'
- 'AGENTS.md'
- 'apps/dsa-web/**'
- 'requirements.txt'
- 'pyproject.toml'
- 'setup.cfg'
- '.github/PULL_REQUEST_TEMPLATE.md'
- '.github/workflows/**'
- '.github/scripts/**'
- 'docker/Dockerfile'
- 'docker-compose.yml'
# 支持手动触发(用于重新审查)
workflow_dispatch:
# 限制并发,避免同一 PR 多次触发时重复评论
@@ -27,7 +35,6 @@ permissions:
contents: read
pull-requests: write
issues: write
actions: read
jobs:
# ==================== 安全检查(检测敏感文件修改)====================
@@ -108,7 +115,7 @@ jobs:
run: |
BASE_REF="${{ github.base_ref || 'main' }}"
CHANGED_FILES=$(git diff --name-only origin/$BASE_REF...HEAD -- '*.py' 2>/dev/null || echo "")
REVIEWABLE_FILES=$(git diff --name-only origin/$BASE_REF...HEAD -- '*.py' '*.md' 'README.md' 'requirements.txt' 'pyproject.toml' 'setup.cfg' '.github/workflows/**' '.github/scripts/**' 2>/dev/null || echo "")
REVIEWABLE_FILES=$(git diff --name-only origin/$BASE_REF...HEAD -- '*.py' '*.md' 'docs/**' 'README.md' 'AGENTS.md' 'requirements.txt' 'pyproject.toml' 'setup.cfg' '.github/PULL_REQUEST_TEMPLATE.md' '.github/workflows/**' '.github/scripts/**' 2>/dev/null || echo "")
if [ -z "$REVIEWABLE_FILES" ]; then
echo "has_reviewable_changes=false" >> $GITHUB_OUTPUT
@@ -216,18 +223,19 @@ jobs:
python-version: '3.11'
- name: 📦 安装依赖
run: pip install openai google-genai httpx
run: pip install google-genai openai httpx
- name: 🤖 AI 审查代码变更
working-directory: pr-code
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_BASE_REF: ${{ github.base_ref || 'main' }}
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
GEMINI_MODEL: ${{ vars.GEMINI_MODEL || 'gemini-2.5-flash' }}
GEMINI_MODEL_FALLBACK: ${{ vars.GEMINI_MODEL_FALLBACK || 'gemini-2.5-flash' }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
OPENAI_BASE_URL: ${{ vars.OPENAI_BASE_URL }}
OPENAI_MODEL: ${{ vars.OPENAI_MODEL }}
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
GEMINI_MODEL: ${{ vars.GEMINI_MODEL }}
AI_REVIEW_STRICT: ${{ vars.AI_REVIEW_STRICT || 'false' }}
CI_SYNTAX_OK: ${{ needs.auto-check.outputs.syntax_ok || '' }}
CI_HAS_PY_CHANGES: ${{ needs.auto-check.outputs.has_py_changes || 'false' }}
@@ -252,7 +260,7 @@ jobs:
uses: actions/checkout@v5
- name: 🏷️ 添加标签
if: github.event_name == 'pull_request'
if: github.event_name == 'pull_request_target'
uses: actions/github-script@v8
with:
script: |
@@ -267,23 +275,26 @@ jobs:
for (const file of files) {
const filename = file.filename.toLowerCase();
if (filename.includes('pool') || filename.includes('orchestrator')) {
labels.add('pool-orchestrator');
if (filename.includes('notification') || filename.includes('webhook')) {
labels.add('notification');
}
if (filename.includes('mail') || filename.includes('email')) {
labels.add('mail-provider');
if (filename.includes('feishu')) {
labels.add('feishu');
}
if (filename.includes('proxy')) {
labels.add('proxy');
if (filename.includes('data_provider') || filename.includes('fetcher')) {
labels.add('data-source');
}
if (filename.includes('openai') || filename.includes('account')) {
labels.add('openai');
if (filename.includes('analyzer') || filename.includes('ai')) {
labels.add('ai');
}
if (filename.endsWith('.md') || filename.includes('readme')) {
if (filename.endsWith('.md') || filename.includes('doc')) {
labels.add('documentation');
}
if (filename.includes('workflow') || filename.includes('.github')) {
labels.add('ci-cd');
labels.add('ci/cd');
}
if (filename.includes('config')) {
labels.add('configuration');
}
if (filename.includes('test')) {
labels.add('testing');
@@ -323,7 +334,7 @@ jobs:
name: 💬 审查报告
runs-on: ubuntu-latest
needs: [security-check, auto-check, ai-review]
if: always() && github.event_name == 'pull_request' && needs.security-check.outputs.safe_to_run == 'true'
if: always() && github.event_name == 'pull_request_target' && needs.security-check.outputs.safe_to_run == 'true'
steps:
- name: 📥 检出代码