Skip to content

✨ feat(code-review): add configurable model input - #37

Merged
lishuceo merged 1 commit into
mainfrom
feat/code-review-model-input
Jul 13, 2026
Merged

✨ feat(code-review): add configurable model input#37
lishuceo merged 1 commit into
mainfrom
feat/code-review-model-input

Conversation

@lishuceo

Copy link
Copy Markdown
Contributor

背景

共享 code-review workflow 把 --model opus 写死,consumer repo 想换 review 模型只能整段抄走 workflow(放弃复用)。这是 RFC 0001 Phase 1 里 model 参数的落地。

改动

  • 新增 model input(required: falsedefault: opus)。
  • --model opus--model ${{ inputs.model || 'opus' }}

|| 'opus' fallback 的必要性:该 workflow 同时被 pull_request 直接触发(review taptap/.github 自身 PR),此时 workflow_call 的 inputs 未填充,inputs.model 为空——fallback 保证直接触发时仍走 opus。

兼容性

完全向后兼容:所有现有 caller(未传 model)默认 opus,行为不变。

首个消费方

maker 将传 model: fable-5(见 taptap/maker 侧 PR)。合并顺序:本 PR 需先合入 main,maker 侧 PR 才能生效(否则 maker 传一个 workflow 尚不认识的 input 会导致校验失败)。

🤖 Generated with Claude Code

Add a `model` input (default `opus`) to the reusable code-review workflow
so consumer repos can pick their review model without forking the workflow.
Implements the `model` parameter from RFC 0001 Phase 1.

`--model opus` becomes `--model ${{ inputs.model || 'opus' }}`; the `|| 'opus'`
fallback keeps direct `pull_request` runs (where workflow_call inputs are
unset) on opus. Backward compatible — existing callers default to opus.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Jul 13, 2026

Copy link
Copy Markdown

Greptile Summary

这个 PR 为共享的 code-review workflow 新增了 model input,让 consumer repo 可以在调用时指定 Claude 模型(如 fable-5),同时保持对未传参 caller 的向后兼容性。

  • workflow_call inputs 中添加了 model 字段(type: stringrequired: falsedefault: opus),供 caller 按需传入模型名或完整模型 ID。
  • --model opus 替换为 --model ${{ inputs.model || 'opus' }},其中 || 'opus' 是处理 pull_request 直接触发(此时 inputs 为空)所必须的 fallback,设计合理。

Confidence Score: 5/5

改动仅新增一个可选 input 并替换一处硬编码字符串,对现有调用方行为零影响,可安全合并。

model input 的 default 值与 || 'opus' fallback 覆盖了 workflow_callpull_request 两种触发方式,双重保险逻辑无误。更改范围极小,无任何功能性退化风险。

无需特别关注的文件。

Important Files Changed

Filename Overview
.github/workflows/code-review.yml 新增 model input 并将硬编码的 --model opus 替换为 `--model ${{ inputs.model

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant PR as pull_request event
    participant CALL as workflow_call (e.g. taptap/maker)
    participant WF as code-review.yml
    participant Claude as claude-code-action

    PR->>WF: trigger (inputs not populated)
    WF->>WF: "inputs.model = ''"
    WF->>Claude: "--model opus (fallback via || 'opus')"

    CALL->>WF: trigger with model: fable-5
    WF->>WF: "inputs.model = 'fable-5'"
    WF->>Claude: --model fable-5
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
    participant PR as pull_request event
    participant CALL as workflow_call (e.g. taptap/maker)
    participant WF as code-review.yml
    participant Claude as claude-code-action

    PR->>WF: trigger (inputs not populated)
    WF->>WF: "inputs.model = ''"
    WF->>Claude: "--model opus (fallback via || 'opus')"

    CALL->>WF: trigger with model: fable-5
    WF->>WF: "inputs.model = 'fable-5'"
    WF->>Claude: --model fable-5
Loading

Reviews (1): Last reviewed commit: "✨ feat(code-review): add configurable mo..." | Re-trigger Greptile

@lishuceo
lishuceo merged commit 9aa61a7 into main Jul 13, 2026
5 of 6 checks passed
@lishuceo
lishuceo deleted the feat/code-review-model-input branch July 13, 2026 08:21

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances the shared code-review reusable workflow by making the Claude model configurable via a new workflow_call input, so consumer repositories can switch review models without duplicating the workflow.

Changes:

  • Added a new model input to workflow_call inputs with default opus.
  • Updated Claude invocation to use the configured model instead of a hardcoded opus.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 152 to 156
claude_args: |
--model opus
--model ${{ inputs.model || 'opus' }}
--max-turns 256
--allowedTools "Read,Glob,Grep,mcp__github_inline_comment__create_inline_comment,Bash(gh api repos/*/pulls/*/comments*),Bash(gh api graphql*),Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr checks:*),Bash(git log:*),Bash(git blame:*),Bash(git diff:*)"
env:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants