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

Function parseAllowedBaseBranches

actions/setup/js/create_pull_request_helpers.cjs:73–88  ·  view source on GitHub ↗

* Parse allowed base branch patterns from config value (array or comma-separated string) * @param {string[]|string|undefined} allowedBaseBranchesValue * @returns {Set }

(allowedBaseBranchesValue)

Source from the content-addressed store, hash-verified

71 * @returns {Set<string>}
72 */
73function 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.

Callers 2

mainFunction · 0.85

Calls 1

addMethod · 0.45

Tested by

no test coverage detected