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

Method generateOpenCodeConfigStep

pkg/workflow/opencode_engine.go:126–144  ·  view source on GitHub ↗

generateOpenCodeConfigStep writes opencode.jsonc with all permissions set to allow to prevent CI hanging on permission prompts.

(_ *WorkflowData)

Source from the content-addressed store, hash-verified

124// generateOpenCodeConfigStep writes opencode.jsonc with all permissions set to allow
125// to prevent CI hanging on permission prompts.
126func (e *OpenCodeEngine) generateOpenCodeConfigStep(_ *WorkflowData) GitHubActionStep {
127 configJSON := `{"agent":{"build":{"permissions":{"bash":"allow","edit":"allow","read":"allow","glob":"allow","grep":"allow","write":"allow","webfetch":"allow","websearch":"allow"}}}}`
128
129 command := fmt.Sprintf(`umask 077
130mkdir -p "$GITHUB_WORKSPACE"
131CONFIG="$GITHUB_WORKSPACE/opencode.jsonc"
132BASE_CONFIG='%s'
133if [ -f "$CONFIG" ]; then
134 MERGED=$(jq -n --argjson base "$BASE_CONFIG" --argjson existing "$(cat "$CONFIG")" '$existing * $base')
135 echo "$MERGED" > "$CONFIG"
136else
137 echo "$BASE_CONFIG" > "$CONFIG"
138fi
139chmod 600 "$CONFIG"`, configJSON)
140
141 stepLines := []string{" - name: Write OpenCode Config"}
142 stepLines = FormatStepWithCommandAndEnv(stepLines, command, nil)
143 return GitHubActionStep(stepLines)
144}

Callers 1

GetExecutionStepsMethod · 0.95

Calls 2

GitHubActionStepTypeAlias · 0.85

Tested by

no test coverage detected