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

Function extractCallWorkflowSecrets

pkg/workflow/call_workflow_secrets.go:22–40  ·  view source on GitHub ↗

extractCallWorkflowSecrets returns the list of secret names declared in the worker workflow's on.workflow_call.secrets section. This is used by orchestrator workflows to map secrets explicitly instead of using secrets: inherit. Priority: .lock.yml > .yml (same as extractCallWorkflowPermissions). .m

(workflowName, markdownPath string)

Source from the content-addressed store, hash-verified

20// Returns nil when no compiled workflow file is found or when no secrets are declared,
21// which signals the caller to fall back to secrets: inherit for backward compatibility.
22func extractCallWorkflowSecrets(workflowName, markdownPath string) ([]string, error) {
23 fileResult, err := findWorkflowFile(workflowName, markdownPath)
24 if err != nil {
25 return nil, fmt.Errorf("failed to find workflow file for '%s': %w", workflowName, err)
26 }
27
28 // Priority: .lock.yml > .yml
29 if fileResult.lockExists {
30 return extractSecretsFromWorkflowFile(fileResult.lockPath)
31 }
32
33 if fileResult.ymlExists {
34 return extractSecretsFromWorkflowFile(fileResult.ymlPath)
35 }
36
37 // No compiled file found — return nil so the caller falls back to secrets: inherit.
38 callWorkflowSecretsLog.Printf("No compiled workflow file found for '%s', falling back to secrets: inherit", workflowName)
39 return nil, nil
40}
41
42// extractSecretsFromWorkflowFile parses a .lock.yml or .yml workflow file and returns
43// the secret names declared in its on.workflow_call.secrets section.

Calls 4

findWorkflowFileFunction · 0.85
ErrorfMethod · 0.45
PrintfMethod · 0.45