parseSecretNames parses newline-delimited GitHub API output and returns the non-empty, trimmed secret names.
(output []byte)
| 60 | // parseSecretNames parses newline-delimited GitHub API output and returns the |
| 61 | // non-empty, trimmed secret names. |
| 62 | func parseSecretNames(output []byte) []string { |
| 63 | trimmed := strings.TrimSpace(string(output)) |
| 64 | if trimmed == "" { |
| 65 | return nil |
| 66 | } |
| 67 | lines := strings.Split(trimmed, "\n") |
| 68 | return sliceutil.Filter( |
| 69 | sliceutil.Map(lines, strings.TrimSpace), |
| 70 | func(name string) bool { return name != "" }, |
| 71 | ) |
| 72 | } |
| 73 | |
| 74 | // resolveEngineApiKeyCredential returns the secret name and value based on the selected engine |
| 75 | // Returns empty value if the secret already exists in the repository |