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

Function getSecretRequirements

pkg/cli/tokens_bootstrap.go:124–153  ·  view source on GitHub ↗

getSecretRequirements discovers all workflows and collects their required secrets

(engineFilter string)

Source from the content-addressed store, hash-verified

122
123// getSecretRequirements discovers all workflows and collects their required secrets
124func getSecretRequirements(engineFilter string) ([]SecretRequirement, error) {
125 tokensBootstrapLog.Printf("Discovering workflows (engine filter: %s)", engineFilter)
126
127 var allRequirements []SecretRequirement
128
129 // If engine is explicitly specified, we can bootstrap without workflows
130 if engineFilter != "" {
131 tokensBootstrapLog.Printf("Engine explicitly specified, bootstrapping for %s regardless of workflows", engineFilter)
132 // Get engine-specific secrets and system secrets (including optional)
133 allRequirements = getSecretRequirementsForEngine(engineFilter, true, true)
134 } else {
135 // Discover workflow files
136 workflowFiles, err := getMarkdownWorkflowFiles("")
137 if err != nil {
138 return nil, fmt.Errorf("failed to discover workflows: %w", err)
139 }
140
141 if len(workflowFiles) == 0 {
142 return nil, errors.New("no workflow files found in .github/workflows/")
143 }
144
145 tokensBootstrapLog.Printf("Found %d workflow files, extracting secrets", len(workflowFiles))
146
147 // Use getRequiredSecretsForWorkflows to collect and deduplicate secrets
148 allRequirements = getSecretsRequirementsForWorkflows(workflowFiles)
149 }
150
151 tokensBootstrapLog.Printf("Returning %d deduplicated secret requirements", len(allRequirements))
152 return allRequirements, nil
153}

Calls 5

getMarkdownWorkflowFilesFunction · 0.85
PrintfMethod · 0.45
ErrorfMethod · 0.45