fix: add model parameter support to base-action (#307)

- Add model field to ClaudeOptions type
- Pass ANTHROPIC_MODEL env var to runClaude function
- Handle --model argument in prepareRunConfig

This allows the model specified in action.yml to be properly passed
to the Claude CLI command.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Gray Choi
2025-07-19 07:48:29 -07:00
committed by GitHub
parent 5c420d2402
commit de86beb3ae
2 changed files with 5 additions and 0 deletions

View File

@@ -26,6 +26,7 @@ async function run() {
appendSystemPrompt: process.env.INPUT_APPEND_SYSTEM_PROMPT, appendSystemPrompt: process.env.INPUT_APPEND_SYSTEM_PROMPT,
claudeEnv: process.env.INPUT_CLAUDE_ENV, claudeEnv: process.env.INPUT_CLAUDE_ENV,
fallbackModel: process.env.INPUT_FALLBACK_MODEL, fallbackModel: process.env.INPUT_FALLBACK_MODEL,
model: process.env.ANTHROPIC_MODEL,
}); });
} catch (error) { } catch (error) {
core.setFailed(`Action failed with error: ${error}`); core.setFailed(`Action failed with error: ${error}`);

View File

@@ -21,6 +21,7 @@ export type ClaudeOptions = {
claudeEnv?: string; claudeEnv?: string;
fallbackModel?: string; fallbackModel?: string;
timeoutMinutes?: string; timeoutMinutes?: string;
model?: string;
}; };
type PreparedConfig = { type PreparedConfig = {
@@ -94,6 +95,9 @@ export function prepareRunConfig(
if (options.fallbackModel) { if (options.fallbackModel) {
claudeArgs.push("--fallback-model", options.fallbackModel); claudeArgs.push("--fallback-model", options.fallbackModel);
} }
if (options.model) {
claudeArgs.push("--model", options.model);
}
if (options.timeoutMinutes) { if (options.timeoutMinutes) {
const timeoutMinutesNum = parseInt(options.timeoutMinutes, 10); const timeoutMinutesNum = parseInt(options.timeoutMinutes, 10);
if (isNaN(timeoutMinutesNum) || timeoutMinutesNum <= 0) { if (isNaN(timeoutMinutesNum) || timeoutMinutesNum <= 0) {