* Parse allowed base branch patterns from config value (array or comma-separated string) * @param {string[]|string|undefined} allowedBaseBranchesValue * @returns {Set }
(allowedBaseBranchesValue)
| 71 | * @returns {Set<string>} |
| 72 | */ |
| 73 | function parseAllowedBaseBranches(allowedBaseBranchesValue) { |
| 74 | const set = new Set(); |
| 75 | if (Array.isArray(allowedBaseBranchesValue)) { |
| 76 | allowedBaseBranchesValue |
| 77 | .map(branch => String(branch).trim()) |
| 78 | .filter(Boolean) |
| 79 | .forEach(branch => set.add(branch)); |
| 80 | } else if (typeof allowedBaseBranchesValue === "string") { |
| 81 | allowedBaseBranchesValue |
| 82 | .split(",") |
| 83 | .map(branch => branch.trim()) |
| 84 | .filter(Boolean) |
| 85 | .forEach(branch => set.add(branch)); |
| 86 | } |
| 87 | return set; |
| 88 | } |
| 89 | |
| 90 | /** |
| 91 | * Check if a base branch matches an allowed pattern. |
no test coverage detected