Skip to content

Commit 18fcaa2

Browse files
authored
pin claude action (#44)
* update action version in GetExecutionConfig to v0.0.56 * Add support for custom action versions in ClaudeEngine execution config * Update ClaudeEngine to use DefaultClaudeActionVersion in execution config * Update Claude Code Action version to v0.0.56 in workflows
1 parent 404a3a7 commit 18fcaa2

6 files changed

Lines changed: 67 additions & 10 deletions

File tree

‎.github/workflows/issue-triage.lock.yml‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎.github/workflows/test-claude.lock.yml‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎.github/workflows/weekly-research.lock.yml‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎pkg/workflow/claude_engine.go‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ import (
66
"strings"
77
)
88

9+
const (
10+
// DefaultClaudeActionVersion is the default version of the Claude Code base action
11+
DefaultClaudeActionVersion = "v0.0.56"
12+
)
13+
914
// ClaudeEngine represents the Claude Code agentic engine
1015
type ClaudeEngine struct {
1116
BaseEngine
@@ -30,9 +35,15 @@ func (e *ClaudeEngine) GetInstallationSteps(engineConfig *EngineConfig) []GitHub
3035
}
3136

3237
func (e *ClaudeEngine) GetExecutionConfig(workflowName string, logFile string, engineConfig *EngineConfig) ExecutionConfig {
38+
// Determine the action version to use
39+
actionVersion := DefaultClaudeActionVersion // Default version
40+
if engineConfig != nil && engineConfig.Version != "" {
41+
actionVersion = engineConfig.Version
42+
}
43+
3344
config := ExecutionConfig{
3445
StepName: "Execute Claude Code Action",
35-
Action: "anthropics/claude-code-base-action@beta",
46+
Action: fmt.Sprintf("anthropics/claude-code-base-action@%s", actionVersion),
3647
Inputs: map[string]string{
3748
"prompt_file": "/tmp/aw-prompts/prompt.txt",
3849
"anthropic_api_key": "${{ secrets.ANTHROPIC_API_KEY }}",

‎pkg/workflow/claude_engine_test.go‎

Lines changed: 50 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
package workflow
22

3-
import "testing"
3+
import (
4+
"fmt"
5+
"testing"
6+
)
47

58
func TestClaudeEngine(t *testing.T) {
69
engine := NewClaudeEngine()
@@ -38,8 +41,8 @@ func TestClaudeEngine(t *testing.T) {
3841
t.Errorf("Expected step name 'Execute Claude Code Action', got '%s'", config.StepName)
3942
}
4043

41-
if config.Action != "anthropics/claude-code-base-action@beta" {
42-
t.Errorf("Expected action 'anthropics/claude-code-base-action@beta', got '%s'", config.Action)
44+
if config.Action != fmt.Sprintf("anthropics/claude-code-base-action@%s", DefaultClaudeActionVersion) {
45+
t.Errorf("Expected action 'anthropics/claude-code-base-action@%s', got '%s'", DefaultClaudeActionVersion, config.Action)
4346
}
4447

4548
if config.Command != "" {
@@ -101,8 +104,8 @@ func TestClaudeEngineConfiguration(t *testing.T) {
101104
t.Errorf("Expected step name 'Execute Claude Code Action', got '%s'", config.StepName)
102105
}
103106

104-
if config.Action != "anthropics/claude-code-base-action@beta" {
105-
t.Errorf("Expected action 'anthropics/claude-code-base-action@beta', got '%s'", config.Action)
107+
if config.Action != fmt.Sprintf("anthropics/claude-code-base-action@%s", DefaultClaudeActionVersion) {
108+
t.Errorf("Expected action 'anthropics/claude-code-base-action@%s', got '%s'", DefaultClaudeActionVersion, config.Action)
106109
}
107110

108111
// Verify all required inputs are present
@@ -115,3 +118,45 @@ func TestClaudeEngineConfiguration(t *testing.T) {
115118
})
116119
}
117120
}
121+
122+
func TestClaudeEngineWithVersion(t *testing.T) {
123+
engine := NewClaudeEngine()
124+
125+
// Test with custom version
126+
engineConfig := &EngineConfig{
127+
ID: "claude",
128+
Version: "v1.2.3",
129+
Model: "claude-3-5-sonnet-20241022",
130+
}
131+
132+
config := engine.GetExecutionConfig("test-workflow", "test-log", engineConfig)
133+
134+
// Check that the version is correctly used in the action
135+
expectedAction := "anthropics/claude-code-base-action@v1.2.3"
136+
if config.Action != expectedAction {
137+
t.Errorf("Expected action '%s', got '%s'", expectedAction, config.Action)
138+
}
139+
140+
// Check that model is set
141+
if config.Inputs["model"] != "claude-3-5-sonnet-20241022" {
142+
t.Errorf("Expected model 'claude-3-5-sonnet-20241022', got '%s'", config.Inputs["model"])
143+
}
144+
}
145+
146+
func TestClaudeEngineWithoutVersion(t *testing.T) {
147+
engine := NewClaudeEngine()
148+
149+
// Test without version (should use default)
150+
engineConfig := &EngineConfig{
151+
ID: "claude",
152+
Model: "claude-3-5-sonnet-20241022",
153+
}
154+
155+
config := engine.GetExecutionConfig("test-workflow", "test-log", engineConfig)
156+
157+
// Check that default version is used
158+
expectedAction := fmt.Sprintf("anthropics/claude-code-base-action@%s", DefaultClaudeActionVersion)
159+
if config.Action != expectedAction {
160+
t.Errorf("Expected action '%s', got '%s'", expectedAction, config.Action)
161+
}
162+
}

‎pkg/workflow/codex_test.go‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package workflow
22

33
import (
4+
"fmt"
45
"os"
56
"path/filepath"
67
"strings"
@@ -166,7 +167,7 @@ This is a test workflow.
166167
if !strings.Contains(lockContent, "Execute Claude Code Action") {
167168
t.Errorf("Expected lock file to contain 'Execute Claude Code Action' step but it didn't.\nContent:\n%s", lockContent)
168169
}
169-
if !strings.Contains(lockContent, "anthropics/claude-code-base-action@beta") {
170+
if !strings.Contains(lockContent, fmt.Sprintf("anthropics/claude-code-base-action@%s", DefaultClaudeActionVersion)) {
170171
t.Errorf("Expected lock file to contain Claude Code action but it didn't.\nContent:\n%s", lockContent)
171172
}
172173
// Check that prompt printing step is present

0 commit comments

Comments
 (0)