MCPcopy Create free account
hub / github.com/github/gh-aw / buildEngineCommandScriptSetup

Function buildEngineCommandScriptSetup

pkg/workflow/copilot_engine_execution.go:669–684  ·  view source on GitHub ↗
(command string)

Source from the content-addressed store, hash-verified

667}
668
669func buildEngineCommandScriptSetup(command string) string {
670 // engine.command intentionally accepts shell-form commands from trusted workflow
671 // configuration authored in-repo; preserve shell semantics and forward driver args.
672 scriptContent := fmt.Sprintf("#!/usr/bin/env bash\nset +o histexpand\nset -eo pipefail\n%s \"$@\"\n", command)
673 heredocDelimiter := "GH_AW_ENGINE_COMMAND_EOF"
674 for strings.Contains(scriptContent, heredocDelimiter) {
675 heredocDelimiter += "_X"
676 }
677
678 return fmt.Sprintf(`mkdir -p /tmp/gh-aw
679umask 0177
680cat > %s <<'%s'
681%s
682%s
683chmod 700 %s`, customEngineCommandScriptPath, heredocDelimiter, scriptContent, heredocDelimiter, customEngineCommandScriptPath)
684}
685
686// generateCopilotSessionFileCopyStep generates a step to copy the entire Copilot
687// session-state directory from ~/.copilot/session-state/ to /tmp/gh-aw/sandbox/agent/logs/

Callers 2

resolveCopilotCommandMethod · 0.85

Calls

no outgoing calls

Tested by 1