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

Function hasDeprecatedGitHubReposField

pkg/cli/codemod_github_repos.go:34–57  ·  view source on GitHub ↗

hasDeprecatedGitHubReposField returns true if tools.github has a deprecated 'repos' field and does not already have an 'allowed-repos' field.

(frontmatter map[string]any)

Source from the content-addressed store, hash-verified

32// hasDeprecatedGitHubReposField returns true if tools.github has a deprecated 'repos' field
33// and does not already have an 'allowed-repos' field.
34func hasDeprecatedGitHubReposField(frontmatter map[string]any) bool {
35 toolsAny, hasTools := frontmatter["tools"]
36 if !hasTools {
37 return false
38 }
39 toolsMap, ok := toolsAny.(map[string]any)
40 if !ok {
41 return false
42 }
43 githubAny, hasGitHub := toolsMap["github"]
44 if !hasGitHub {
45 return false
46 }
47 githubMap, ok := githubAny.(map[string]any)
48 if !ok {
49 return false
50 }
51 _, hasRepos := githubMap["repos"]
52 _, hasAllowedRepos := githubMap["allowed-repos"] // only check existence, not value
53 if hasRepos && !hasAllowedRepos {
54 githubReposCodemodLog.Print("Deprecated 'repos' field found in tools.github")
55 }
56 return hasRepos && !hasAllowedRepos
57}
58
59// renameGitHubReposToAllowedRepos renames 'repos:' to 'allowed-repos:' within the
60// tools.github configuration block.

Callers 1

Calls 1

PrintMethod · 0.80

Tested by

no test coverage detected