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

Function transformRepoPattern

pkg/workflow/mcp_github_config.go:517–525  ·  view source on GitHub ↗

transformRepoPattern transforms a repos pattern to the corresponding accept pattern. Rules: - "O/*" → "private:O" (owner wildcard → strip wildcard) - "O/P*" → "private:O/P*" (prefix wildcard → keep as-is) - "O/R" → "private:O/R" (specific repo → keep as-is)

(pattern string)

Source from the content-addressed store, hash-verified

515// - "O/P*" → "private:O/P*" (prefix wildcard → keep as-is)
516// - "O/R" → "private:O/R" (specific repo → keep as-is)
517func transformRepoPattern(pattern string) string {
518 // Check if pattern ends with "/*" (owner wildcard)
519 if owner, found := strings.CutSuffix(pattern, "/*"); found {
520 // Strip the wildcard: "owner/*" → "private:owner"
521 return "private:" + owner
522 }
523 // All other patterns (including "O/P*" prefix wildcards): add "private:" prefix
524 return "private:" + pattern
525}
526
527// deriveWriteSinkGuardPolicyFromWorkflow derives a write-sink guard policy for non-GitHub MCP servers
528// from the workflow's GitHub guard-policy configuration. This uses the same derivation as

Calls

no outgoing calls

Tested by

no test coverage detected