Skip to content
Draft
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
12 changes: 12 additions & 0 deletions pkg/workflow/compiler_yaml_lookups.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,18 @@ func getVersionForSetup(data *WorkflowData) string {
}
}

// getEngineIDForSetup returns the engine ID to inject into setup-step env.
// Prefer EngineConfig.ID and fall back to the legacy AI field.
func getEngineIDForSetup(data *WorkflowData) string {
if data == nil {
return ""
}
if data.EngineConfig != nil && data.EngineConfig.ID != "" {
return data.EngineConfig.ID
}
return data.AI
}

// getInstallationVersion returns the version that will be installed for the given engine.
// This matches the logic in BuildStandardNpmEngineInstallSteps.
func getInstallationVersion(data *WorkflowData, engine CodingAgentEngine) string {
Expand Down
8 changes: 8 additions & 0 deletions pkg/workflow/compiler_yaml_step_generation.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ func setupParentSpanNeedsExpr(upstreamJob constants.JobName) string {
}

func (c *Compiler) generateSetupStep(data *WorkflowData, setupActionRef string, destination string, enableArtifactClient bool, traceID string, parentSpanID string) []string {
engineID := getEngineIDForSetup(data)

// Script mode: run the setup.sh script directly
if c.actionMode.IsScript() {
lines := []string{
Expand All @@ -144,6 +146,9 @@ func (c *Compiler) generateSetupStep(data *WorkflowData, setupActionRef string,
fmt.Sprintf(" GH_AW_SETUP_WORKFLOW_NAME: %q\n", data.Name),
fmt.Sprintf(" GH_AW_CURRENT_WORKFLOW_REF: %s\n", buildSetupWorkflowRefExpr(data)),
)
if engineID != "" {
lines = append(lines, fmt.Sprintf(" GH_AW_INFO_ENGINE_ID: %q\n", engineID))
}
if v := getVersionForSetup(data); v != "" {
lines = append(lines, fmt.Sprintf(" GH_AW_INFO_VERSION: %q\n", v))
}
Expand Down Expand Up @@ -187,6 +192,9 @@ func (c *Compiler) generateSetupStep(data *WorkflowData, setupActionRef string,
fmt.Sprintf(" GH_AW_SETUP_WORKFLOW_NAME: %q\n", data.Name),
fmt.Sprintf(" GH_AW_CURRENT_WORKFLOW_REF: %s\n", buildSetupWorkflowRefExpr(data)),
)
if engineID != "" {
lines = append(lines, fmt.Sprintf(" GH_AW_INFO_ENGINE_ID: %q\n", engineID))
}
if v := getVersionForSetup(data); v != "" {
lines = append(lines, fmt.Sprintf(" GH_AW_INFO_VERSION: %q\n", v))
}
Expand Down
31 changes: 31 additions & 0 deletions pkg/workflow/setup_step_version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,3 +153,34 @@ func TestGenerateSetupStepIncludesParentSpanID(t *testing.T) {
t.Fatalf("expected setup step to include parent-span-id input, got:\n%s", combined)
}
}

func TestGenerateSetupStepIncludesEngineID(t *testing.T) {
t.Run("action mode injects engine id", func(t *testing.T) {
c := NewCompiler()
data := &WorkflowData{
Name: "my-workflow",
EngineConfig: &EngineConfig{ID: "codex"},
}
lines := c.generateSetupStep(data, "github/gh-aw/actions/setup@abc123", "${{ runner.temp }}/gh-aw", false, "", "")
combined := strings.Join(lines, "")

if !strings.Contains(combined, `GH_AW_INFO_ENGINE_ID: "codex"`) {
t.Fatalf("expected setup step to include GH_AW_INFO_ENGINE_ID for action mode, got:\n%s", combined)
}
})

t.Run("script mode injects engine id", func(t *testing.T) {
c := NewCompiler()
c.actionMode = ActionModeScript
data := &WorkflowData{
Name: "my-workflow",
AI: "copilot",
}
lines := c.generateSetupStep(data, "./actions/setup", "${{ runner.temp }}/gh-aw", false, "", "")
combined := strings.Join(lines, "")

if !strings.Contains(combined, `GH_AW_INFO_ENGINE_ID: "copilot"`) {
t.Fatalf("expected setup step to include GH_AW_INFO_ENGINE_ID for script mode, got:\n%s", combined)
}
})
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ jobs:
env:
GH_AW_SETUP_WORKFLOW_NAME: "basic-copilot-test"
GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/basic-copilot.lock.yml@${{ github.ref }}
GH_AW_INFO_ENGINE_ID: "copilot"
GH_AW_INFO_VERSION: "1.0.43"
- name: Generate agentic run info
id: generate_aw_info
Expand Down Expand Up @@ -289,6 +290,7 @@ jobs:
env:
GH_AW_SETUP_WORKFLOW_NAME: "basic-copilot-test"
GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/basic-copilot.lock.yml@${{ github.ref }}
GH_AW_INFO_ENGINE_ID: "copilot"
GH_AW_INFO_VERSION: "1.0.43"
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
Expand Down Expand Up @@ -628,6 +630,7 @@ jobs:
env:
GH_AW_SETUP_WORKFLOW_NAME: "basic-copilot-test"
GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/basic-copilot.lock.yml@${{ github.ref }}
GH_AW_INFO_ENGINE_ID: "copilot"
GH_AW_INFO_VERSION: "1.0.43"
- name: Check team membership for workflow
id: check_membership
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ jobs:
env:
GH_AW_SETUP_WORKFLOW_NAME: "Test Playwright CLI Mode"
GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/playwright-cli-mode.lock.yml@${{ github.ref }}
GH_AW_INFO_ENGINE_ID: "copilot"
GH_AW_INFO_VERSION: "1.0.43"
- name: Generate agentic run info
id: generate_aw_info
Expand Down Expand Up @@ -299,6 +300,7 @@ jobs:
env:
GH_AW_SETUP_WORKFLOW_NAME: "Test Playwright CLI Mode"
GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/playwright-cli-mode.lock.yml@${{ github.ref }}
GH_AW_INFO_ENGINE_ID: "copilot"
GH_AW_INFO_VERSION: "1.0.43"
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
Expand Down Expand Up @@ -642,6 +644,7 @@ jobs:
env:
GH_AW_SETUP_WORKFLOW_NAME: "Test Playwright CLI Mode"
GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/playwright-cli-mode.lock.yml@${{ github.ref }}
GH_AW_INFO_ENGINE_ID: "copilot"
GH_AW_INFO_VERSION: "1.0.43"
- name: Check team membership for workflow
id: check_membership
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ jobs:
env:
GH_AW_SETUP_WORKFLOW_NAME: "Smoke Copilot"
GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/smoke-copilot.lock.yml@${{ github.ref }}
GH_AW_INFO_ENGINE_ID: "copilot"
GH_AW_INFO_VERSION: "1.0.43"
- name: Generate agentic run info
id: generate_aw_info
Expand Down Expand Up @@ -405,6 +406,7 @@ jobs:
env:
GH_AW_SETUP_WORKFLOW_NAME: "Smoke Copilot"
GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/smoke-copilot.lock.yml@${{ github.ref }}
GH_AW_INFO_ENGINE_ID: "copilot"
GH_AW_INFO_VERSION: "1.0.43"
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
Expand Down Expand Up @@ -874,6 +876,7 @@ jobs:
env:
GH_AW_SETUP_WORKFLOW_NAME: "Smoke Copilot"
GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/smoke-copilot.lock.yml@${{ github.ref }}
GH_AW_INFO_ENGINE_ID: "copilot"
GH_AW_INFO_VERSION: "1.0.43"
- name: Check team membership for workflow
id: check_membership
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ jobs:
env:
GH_AW_SETUP_WORKFLOW_NAME: "with-imports-test"
GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/with-imports.lock.yml@${{ github.ref }}
GH_AW_INFO_ENGINE_ID: "copilot"
GH_AW_INFO_VERSION: "1.0.43"
- name: Generate agentic run info
id: generate_aw_info
Expand Down Expand Up @@ -290,6 +291,7 @@ jobs:
env:
GH_AW_SETUP_WORKFLOW_NAME: "with-imports-test"
GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/with-imports.lock.yml@${{ github.ref }}
GH_AW_INFO_ENGINE_ID: "copilot"
GH_AW_INFO_VERSION: "1.0.43"
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
Expand Down Expand Up @@ -629,6 +631,7 @@ jobs:
env:
GH_AW_SETUP_WORKFLOW_NAME: "with-imports-test"
GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/with-imports.lock.yml@${{ github.ref }}
GH_AW_INFO_ENGINE_ID: "copilot"
GH_AW_INFO_VERSION: "1.0.43"
- name: Check team membership for workflow
id: check_membership
Expand Down