Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/issue-triage.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .github/workflows/test-claude.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .github/workflows/weekly-research.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 12 additions & 1 deletion pkg/workflow/claude_engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }}",
Expand Down
55 changes: 50 additions & 5 deletions pkg/workflow/claude_engine_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package workflow

import "testing"
import (
"fmt"
"testing"
)

func TestClaudeEngine(t *testing.T) {
engine := NewClaudeEngine()
Expand Down Expand Up @@ -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 != "" {
Expand Down Expand Up @@ -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
Expand All @@ -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)
}
}
3 changes: 2 additions & 1 deletion pkg/workflow/codex_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package workflow

import (
"fmt"
"os"
"path/filepath"
"strings"
Expand Down Expand Up @@ -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
Expand Down