diff --git a/.github/workflows/issue-triage.lock.yml b/.github/workflows/issue-triage.lock.yml index cad8128f16..51bfaf1ee9 100644 --- a/.github/workflows/issue-triage.lock.yml +++ b/.github/workflows/issue-triage.lock.yml @@ -241,7 +241,7 @@ jobs: console.log(JSON.stringify(awInfo, null, 2)); - name: Execute Claude Code Action id: agentic_execution - uses: anthropics/claude-code-base-action@beta + uses: anthropics/claude-code-base-action@v0.0.56 with: # Allowed tools (sorted): # - Bash(echo:*) diff --git a/.github/workflows/test-claude.lock.yml b/.github/workflows/test-claude.lock.yml index e295636f9c..eba2b22a5e 100644 --- a/.github/workflows/test-claude.lock.yml +++ b/.github/workflows/test-claude.lock.yml @@ -255,7 +255,7 @@ jobs: console.log(JSON.stringify(awInfo, null, 2)); - name: Execute Claude Code Action id: agentic_execution - uses: anthropics/claude-code-base-action@beta + uses: anthropics/claude-code-base-action@v0.0.56 with: # Allowed tools (sorted): # - Glob diff --git a/.github/workflows/weekly-research.lock.yml b/.github/workflows/weekly-research.lock.yml index 76b7c85dba..9a8f755844 100644 --- a/.github/workflows/weekly-research.lock.yml +++ b/.github/workflows/weekly-research.lock.yml @@ -211,7 +211,7 @@ jobs: console.log(JSON.stringify(awInfo, null, 2)); - name: Execute Claude Code Action id: agentic_execution - uses: anthropics/claude-code-base-action@beta + uses: anthropics/claude-code-base-action@v0.0.56 with: # Allowed tools (sorted): # - Bash(echo:*) diff --git a/pkg/workflow/claude_engine.go b/pkg/workflow/claude_engine.go index a99bdb0588..8997ea3bfc 100644 --- a/pkg/workflow/claude_engine.go +++ b/pkg/workflow/claude_engine.go @@ -6,6 +6,11 @@ import ( "strings" ) +const ( + // DefaultClaudeActionVersion is the default version of the Claude Code base action + DefaultClaudeActionVersion = "v0.0.56" +) + // ClaudeEngine represents the Claude Code agentic engine type ClaudeEngine struct { BaseEngine @@ -30,9 +35,15 @@ func (e *ClaudeEngine) GetInstallationSteps(engineConfig *EngineConfig) []GitHub } func (e *ClaudeEngine) GetExecutionConfig(workflowName string, logFile string, engineConfig *EngineConfig) ExecutionConfig { + // Determine the action version to use + actionVersion := DefaultClaudeActionVersion // Default version + if engineConfig != nil && engineConfig.Version != "" { + actionVersion = engineConfig.Version + } + config := ExecutionConfig{ StepName: "Execute Claude Code Action", - Action: "anthropics/claude-code-base-action@beta", + Action: fmt.Sprintf("anthropics/claude-code-base-action@%s", actionVersion), Inputs: map[string]string{ "prompt_file": "/tmp/aw-prompts/prompt.txt", "anthropic_api_key": "${{ secrets.ANTHROPIC_API_KEY }}", diff --git a/pkg/workflow/claude_engine_test.go b/pkg/workflow/claude_engine_test.go index c4b5a930ec..261af2458f 100644 --- a/pkg/workflow/claude_engine_test.go +++ b/pkg/workflow/claude_engine_test.go @@ -1,6 +1,9 @@ package workflow -import "testing" +import ( + "fmt" + "testing" +) func TestClaudeEngine(t *testing.T) { engine := NewClaudeEngine() @@ -38,8 +41,8 @@ func TestClaudeEngine(t *testing.T) { t.Errorf("Expected step name 'Execute Claude Code Action', got '%s'", config.StepName) } - if config.Action != "anthropics/claude-code-base-action@beta" { - t.Errorf("Expected action 'anthropics/claude-code-base-action@beta', got '%s'", config.Action) + if config.Action != fmt.Sprintf("anthropics/claude-code-base-action@%s", DefaultClaudeActionVersion) { + t.Errorf("Expected action 'anthropics/claude-code-base-action@%s', got '%s'", DefaultClaudeActionVersion, config.Action) } if config.Command != "" { @@ -101,8 +104,8 @@ func TestClaudeEngineConfiguration(t *testing.T) { t.Errorf("Expected step name 'Execute Claude Code Action', got '%s'", config.StepName) } - if config.Action != "anthropics/claude-code-base-action@beta" { - t.Errorf("Expected action 'anthropics/claude-code-base-action@beta', got '%s'", config.Action) + if config.Action != fmt.Sprintf("anthropics/claude-code-base-action@%s", DefaultClaudeActionVersion) { + t.Errorf("Expected action 'anthropics/claude-code-base-action@%s', got '%s'", DefaultClaudeActionVersion, config.Action) } // Verify all required inputs are present @@ -115,3 +118,45 @@ func TestClaudeEngineConfiguration(t *testing.T) { }) } } + +func TestClaudeEngineWithVersion(t *testing.T) { + engine := NewClaudeEngine() + + // Test with custom version + engineConfig := &EngineConfig{ + ID: "claude", + Version: "v1.2.3", + Model: "claude-3-5-sonnet-20241022", + } + + config := engine.GetExecutionConfig("test-workflow", "test-log", engineConfig) + + // Check that the version is correctly used in the action + expectedAction := "anthropics/claude-code-base-action@v1.2.3" + if config.Action != expectedAction { + t.Errorf("Expected action '%s', got '%s'", expectedAction, config.Action) + } + + // Check that model is set + if config.Inputs["model"] != "claude-3-5-sonnet-20241022" { + t.Errorf("Expected model 'claude-3-5-sonnet-20241022', got '%s'", config.Inputs["model"]) + } +} + +func TestClaudeEngineWithoutVersion(t *testing.T) { + engine := NewClaudeEngine() + + // Test without version (should use default) + engineConfig := &EngineConfig{ + ID: "claude", + Model: "claude-3-5-sonnet-20241022", + } + + config := engine.GetExecutionConfig("test-workflow", "test-log", engineConfig) + + // Check that default version is used + expectedAction := fmt.Sprintf("anthropics/claude-code-base-action@%s", DefaultClaudeActionVersion) + if config.Action != expectedAction { + t.Errorf("Expected action '%s', got '%s'", expectedAction, config.Action) + } +} diff --git a/pkg/workflow/codex_test.go b/pkg/workflow/codex_test.go index 45ac0b3f77..1a23a01d9b 100644 --- a/pkg/workflow/codex_test.go +++ b/pkg/workflow/codex_test.go @@ -1,6 +1,7 @@ package workflow import ( + "fmt" "os" "path/filepath" "strings" @@ -166,7 +167,7 @@ This is a test workflow. if !strings.Contains(lockContent, "Execute Claude Code Action") { t.Errorf("Expected lock file to contain 'Execute Claude Code Action' step but it didn't.\nContent:\n%s", lockContent) } - if !strings.Contains(lockContent, "anthropics/claude-code-base-action@beta") { + if !strings.Contains(lockContent, fmt.Sprintf("anthropics/claude-code-base-action@%s", DefaultClaudeActionVersion)) { t.Errorf("Expected lock file to contain Claude Code action but it didn't.\nContent:\n%s", lockContent) } // Check that prompt printing step is present