|
| 1 | +name: Code Reviewer Workflow |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + types: [opened, synchronize, reopened, ready_for_review] |
| 6 | + |
| 7 | +permissions: |
| 8 | + contents: read |
| 9 | + pull-requests: write |
| 10 | + issues: write |
| 11 | + |
| 12 | +jobs: |
| 13 | + review: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + env: |
| 16 | + OPENAI_API_KEY: ${{ secrets.ZENMUX_API_KEY }} |
| 17 | + steps: |
| 18 | + - name: Check OPENAI_API_KEY |
| 19 | + if: ${{ env.OPENAI_API_KEY == '' }} |
| 20 | + run: echo "OPENAI_API_KEY is not set. Skip review run." |
| 21 | + |
| 22 | + - name: Run AI Code Review Action |
| 23 | + if: ${{ env.OPENAI_API_KEY != '' }} |
| 24 | + uses: TiyAgents/code-review-agent-action@v1 |
| 25 | + with: |
| 26 | + # [Required] GitHub token with pull-requests:write and issues:write permissions |
| 27 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 28 | + |
| 29 | + # [Conditionally required] OpenAI key. If not provided here, |
| 30 | + # it must be available via OPENAI_API_KEY environment variable |
| 31 | + openai_api_key: ${{ env.OPENAI_API_KEY }} |
| 32 | + |
| 33 | + # [Optional] OpenAI base URL; any OpenAI-compatible API base URL |
| 34 | + # If omitted, default official base is used; can also come from OPENAI_API_BASE |
| 35 | + openai_api_base: ${{ vars.OPENAI_API_BASE }} |
| 36 | + |
| 37 | + # [Optional] Allowed hosts for openai_api_base (comma/newline separated); default api.openai.com |
| 38 | + # Required when using a custom OpenAI-compatible gateway host |
| 39 | + openai_api_base_allowlist: | |
| 40 | + api.openai.com |
| 41 | + zenmux.ai |
| 42 | +
|
| 43 | + # [Optional] Include globs (comma or newline separated); default is ** (all files) |
| 44 | + # Allowed values: any valid glob patterns |
| 45 | + include: | |
| 46 | + **/*.js |
| 47 | + **/*.ts |
| 48 | +
|
| 49 | + # [Optional] Exclude globs (comma or newline separated); default is empty |
| 50 | + # Allowed values: any valid glob patterns |
| 51 | + exclude: | |
| 52 | + **/*.lock |
| 53 | + **/dist/** |
| 54 | + **/*.min.js |
| 55 | + **/release/** |
| 56 | +
|
| 57 | + # [Optional] Planner model; default is gpt-5.3-codex |
| 58 | + # Allowed values: any available model name (string) |
| 59 | + planner_model: ${{ vars.PLANNER_OPENAI_MODEL }} |
| 60 | + |
| 61 | + # [Optional] Sub-agent model; default is gpt-5.3-codex |
| 62 | + # Allowed values: any available model name (string) |
| 63 | + reviewer_model: ${{ vars.DEFAULT_OPENAI_MODEL }} |
| 64 | + |
| 65 | + # [Optional] Review dimensions (comma or newline separated); |
| 66 | + # default is general,security,performance,testing |
| 67 | + # Suggested values: general, security, performance, testing |
| 68 | + review_dimensions: general,security,performance,testing |
| 69 | + |
| 70 | + # [Optional] Review language; default is English |
| 71 | + # Allowed values: any language label (for example English, Chinese, Simplified Chinese) |
| 72 | + review_language: English |
| 73 | + |
| 74 | + # [Optional] Minimum confidence to keep a finding; default is 0.72 |
| 75 | + # Allowed range: 0.0 - 1.0 (float) |
| 76 | + min_finding_confidence: 0.72 |
| 77 | + |
| 78 | + # [Optional] Round-1 coverage-first mode; default is true |
| 79 | + # Allowed values: true, false |
| 80 | + # true: first round runs only primary dimension to reduce duplicates/cost |
| 81 | + coverage_first_round_primary_only: true |
| 82 | + |
| 83 | + # [Optional] Auto-minimize outdated historical inline comments from this action; default is true |
| 84 | + # Allowed values: true, false |
| 85 | + auto_minimize_outdated_comments: true |
| 86 | + |
| 87 | + # [Optional] Maximum review rounds; default is 8 |
| 88 | + # Allowed range: positive integer (>=1) |
| 89 | + # Rough sizing: increase with max_model_calls if many files are changed |
| 90 | + max_rounds: 4 |
| 91 | + |
| 92 | + # [Optional] Maximum model calls; default is 40 |
| 93 | + # Allowed range: positive integer (>=1) |
| 94 | + # Rough sizing: calls ~= rounds * (1 + ceil(patch_files / batch_size) * dimensions) |
| 95 | + # Example: ~100 changed files with default dimensions usually needs 80-120 calls |
| 96 | + max_model_calls: 64 |
| 97 | + |
| 98 | + # [Optional] Maximum files per batch; default is 8 |
| 99 | + # Allowed range: positive integer (>=1) |
| 100 | + # Larger value reduces batch count (and model calls) but increases per-call context size |
| 101 | + max_files_per_batch: 16 |
| 102 | + |
| 103 | + # [Optional] Maximum context characters per batch; default is 128000 |
| 104 | + # Allowed range: positive integer (>=1) |
| 105 | + max_context_chars: 256000 |
| 106 | + |
| 107 | + # [Optional] Maximum findings kept after aggregation; default is 60 |
| 108 | + # Allowed range: positive integer (>=1) |
| 109 | + max_findings: 64 |
| 110 | + |
| 111 | + # [Optional] Maximum inline comments posted in PR review; default is 30 |
| 112 | + # Allowed range: positive integer (>=1) |
| 113 | + max_inline_comments: 32 |
0 commit comments