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

Function checkAndEnsureEngineSecretsForEngine

pkg/cli/engine_secrets.go:190–213  ·  view source on GitHub ↗

checkAndEnsureEngineSecretsForEngine is the unified entry point for checking and collecting engine secrets. It checks existing secrets in the repository and environment, and prompts for missing ones.

(config EngineSecretConfig)

Source from the content-addressed store, hash-verified

188// checkAndEnsureEngineSecretsForEngine is the unified entry point for checking and collecting engine secrets.
189// It checks existing secrets in the repository and environment, and prompts for missing ones.
190func checkAndEnsureEngineSecretsForEngine(config EngineSecretConfig) error {
191 engineSecretsLog.Printf("Checking and collecting secrets for engine: %s in repo: %s", config.Engine, config.RepoSlug)
192
193 // Get required secrets for the engine
194 requirements := getSecretRequirementsForEngine(config.Engine, config.IncludeSystemSecrets, config.IncludeOptional)
195
196 // Check each requirement
197 for _, req := range requirements {
198 if req.Optional {
199 // For optional secrets, just check and report
200 if err := checkOptionalSecret(req, config); err != nil && config.Verbose {
201 fmt.Fprintln(os.Stderr, console.FormatWarningMessage(fmt.Sprintf("Optional secret %s: %v", req.Name, err)))
202 }
203 continue
204 }
205
206 // For required secrets, ensure they're available
207 if err := ensureSecretAvailable(req, config); err != nil {
208 return fmt.Errorf("failed to ensure secret %s: %w", req.Name, err)
209 }
210 }
211
212 return nil
213}
214
215// ensureSecretAvailable ensures that a required secret is available.
216// It checks the repository, environment, and prompts the user if needed.

Callers 2

RunWorkflowTrialsFunction · 0.85

Calls 6

FormatWarningMessageFunction · 0.92
checkOptionalSecretFunction · 0.85
ensureSecretAvailableFunction · 0.85
PrintfMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected