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
14 changes: 7 additions & 7 deletions .github/workflows/daily-issues-report.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/daily-issues-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ permissions:
engine:
id: copilot
copilot-sdk: true
driver: .github/drivers/copilot_sdk_driver_sample_python.py
driver: .github/drivers/copilot_sdk_driver_sample_node.cjs
runs-on: aw-gpu-runner-T4
strict: true
tracker-id: daily-issues-report
Expand Down
21 changes: 18 additions & 3 deletions .github/workflows/smoke-call-workflow.lock.yml

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

28 changes: 28 additions & 0 deletions pkg/workflow/copilot_engine_execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ const nodePathSetupCommand = `GH_AW_NPM_GLOBAL_ROOT="$(npm root -g 2>/dev/null |
const nodeRuntimeResolutionCommand = `GH_AW_NODE_EXEC="${GH_AW_NODE_BIN:-}"; if [ -z "$GH_AW_NODE_EXEC" ] || [ ! -x "$GH_AW_NODE_EXEC" ]; then GH_AW_NODE_EXEC="$(command -v node 2>/dev/null || true)"; fi; if [ -z "$GH_AW_NODE_EXEC" ]; then echo "node runtime missing on this runner — check runtimes.node in workflow YAML" >&2; exit 127; fi; ` + nodePathSetupCommand + `; "$GH_AW_NODE_EXEC"`
const nodePathSetupCommandForCopilotSDK = `GH_AW_WORKSPACE_NODE_MODULES="${GITHUB_WORKSPACE:-$PWD}/node_modules"; if [ -d "$GH_AW_WORKSPACE_NODE_MODULES" ]; then export NODE_PATH="${GH_AW_WORKSPACE_NODE_MODULES}${NODE_PATH:+:${NODE_PATH}}"; fi; ` + nodePathSetupCommand
const nodeRuntimeResolutionCommandForCopilotSDK = `GH_AW_NODE_EXEC="${GH_AW_NODE_BIN:-}"; if [ -z "$GH_AW_NODE_EXEC" ] || [ ! -x "$GH_AW_NODE_EXEC" ]; then GH_AW_NODE_EXEC="$(command -v node 2>/dev/null || true)"; fi; if [ -z "$GH_AW_NODE_EXEC" ]; then echo "node runtime missing on this runner — check runtimes.node in workflow YAML" >&2; exit 127; fi; ` + nodePathSetupCommandForCopilotSDK + `; "$GH_AW_NODE_EXEC"`
const copilotSDKPythonPathExpression = "${{ github.workspace }}/.gh-aw/copilot-sdk/python"

// copilotSDKDriverExecArgs returns the runtime command and driver path argument for the
// given SDK driver filename.
Expand Down Expand Up @@ -146,6 +147,30 @@ func copilotSDKDriverExecArgs(driverName string) (runtimeCmd, driverArg string)
}
}

// copilotSDKRuntimeID returns the runtime ID used by Copilot SDK driver execution.
// It returns one of: python, typescript, ruby, or node (default/fallback).
// engine.command takes precedence; otherwise runtime is inferred from engine.driver extension.
func copilotSDKRuntimeID(workflowData *WorkflowData) string {
if workflowData == nil || workflowData.EngineConfig == nil {
return "node"
}
command := workflowData.EngineConfig.Command
if command != "" {
return detectRuntimeFromCopilotCommand(command)
}
ext := strings.ToLower(filepath.Ext(workflowData.EngineConfig.Driver))
switch ext {
case ".py":
return "python"
case ".ts", ".mts":
return "typescript"
case ".rb":
return "ruby"
default:
return "node"
}
}

// GetExecutionSteps returns the GitHub Actions steps for executing GitHub Copilot CLI
func (e *CopilotEngine) GetExecutionSteps(workflowData *WorkflowData, logFile string) []GitHubActionStep {
copilotExecLog.Printf("Generating execution steps for Copilot: workflow=%s, firewall=%v", workflowData.Name, isFirewallEnabled(workflowData))
Expand Down Expand Up @@ -633,6 +658,9 @@ func (e *CopilotEngine) addCopilotSDKStepEnv(env map[string]string, workflowData
env[constants.CopilotSDKDriverEnvVar] = "1"
env[constants.CopilotSDKServerArgsEnvVar] = copilotSDKServerArgsJSON
copilotExecLog.Printf("copilot-sdk driver mode: set %s and %s", constants.CopilotSDKDriverEnvVar, constants.CopilotSDKServerArgsEnvVar)
if currentPythonPath, exists := env["PYTHONPATH"]; copilotSDKRuntimeID(workflowData) == "python" && (!exists || currentPythonPath == "") {
env["PYTHONPATH"] = copilotSDKPythonPathExpression
}
Comment on lines +661 to +663
}

func (e *CopilotEngine) buildCopilotExecutionStep(workflowData *WorkflowData, command string, env map[string]string, timeoutValue string) GitHubActionStep {
Expand Down
8 changes: 7 additions & 1 deletion pkg/workflow/copilot_engine_installation.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package workflow

import (
"fmt"
"path/filepath"
"strings"

Expand All @@ -33,6 +34,7 @@ type copilotSDKInstallSpec struct {
}

const workspaceCommandPrefix = `cd "${GITHUB_WORKSPACE}" && `
const copilotSDKPythonTargetDir = `${GITHUB_WORKSPACE}/.gh-aw/copilot-sdk/python`

// getWorkspaceCommandPrefixFor returns the shell cd prefix for engine command generation.
// When engine.cwd is configured it returns a prefix that changes to ${GH_AW_ENGINE_CWD}
Expand Down Expand Up @@ -203,7 +205,11 @@ func getCopilotSDKInstallSpec(command string) copilotSDKInstallSpec {
switch runtimeID {
case "python":
spec.stepName = "Install GitHub Copilot SDK (Python)"
spec.command = workspaceCommandPrefix + "python3 -m pip install --disable-pip-version-check github-copilot-sdk==" + version
spec.command = workspaceCommandPrefix + fmt.Sprintf(
`mkdir -p "%[1]s" && python3 -m pip install --disable-pip-version-check --target "%[1]s" github-copilot-sdk==%[2]s`,
copilotSDKPythonTargetDir,
version,
)
Comment on lines +208 to +212
case "typescript":
spec.stepName = "Install GitHub Copilot SDK (TypeScript)"
spec.command = workspaceCommandPrefix + "npm install --ignore-scripts --no-save @github/copilot-sdk@" + version + " ts-node typescript"
Expand Down
Loading
Loading