GetExecutionSteps returns the GitHub Actions steps for executing GitHub Copilot CLI
(workflowData *WorkflowData, logFile string)
| 148 | |
| 149 | // GetExecutionSteps returns the GitHub Actions steps for executing GitHub Copilot CLI |
| 150 | func (e *CopilotEngine) GetExecutionSteps(workflowData *WorkflowData, logFile string) []GitHubActionStep { |
| 151 | copilotExecLog.Printf("Generating execution steps for Copilot: workflow=%s, firewall=%v", workflowData.Name, isFirewallEnabled(workflowData)) |
| 152 | |
| 153 | sandboxEnabled := isFirewallEnabled(workflowData) |
| 154 | llmProvider := e.ResolveLLMProvider(workflowData) |
| 155 | providerOverrideBYOK := llmProvider != LLMProviderGitHub && sandboxEnabled |
| 156 | isBYOKMode := providerOverrideBYOK || engineEnvHasKey(workflowData, constants.CopilotProviderBaseURL) |
| 157 | isDetectionJob := workflowData.SafeOutputs == nil |
| 158 | modelConfigured := workflowData.EngineConfig != nil && workflowData.EngineConfig.Model != "" |
| 159 | copilotArgs := e.buildCopilotArgs(workflowData) |
| 160 | mkdirCommands := buildCopilotMkdirCommands(copilotArgs) |
| 161 | modelEnvVar := getCopilotModelEnvVar(isDetectionJob) |
| 162 | timeoutValue := getCopilotTimeoutValue(workflowData) |
| 163 | commandName, customCommandScriptSetup := e.resolveCopilotCommand(workflowData, sandboxEnabled) |
| 164 | execPrefix := e.buildCopilotExecPrefix(workflowData, commandName) |
| 165 | command, copilotSDKServerArgsJSON := e.buildCopilotCommand( |
| 166 | workflowData, copilotArgs, execPrefix, customCommandScriptSetup, logFile, mkdirCommands, isBYOKMode, |
| 167 | ) |
| 168 | env := e.buildCopilotStepEnv( |
| 169 | workflowData, llmProvider, modelEnvVar, timeoutValue, isBYOKMode, sandboxEnabled, modelConfigured, copilotSDKServerArgsJSON, |
| 170 | ) |
| 171 | |
| 172 | return []GitHubActionStep{e.buildCopilotExecutionStep(workflowData, command, env, timeoutValue)} |
| 173 | } |
| 174 | |
| 175 | // buildCopilotArgs builds the Copilot CLI argument list based on workflow configuration. |
| 176 | func (e *CopilotEngine) buildCopilotArgs(workflowData *WorkflowData) []string { |