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

Function getGitHubAppClientIDCodemod

pkg/cli/codemod_github_app_client_id.go:13–30  ·  view source on GitHub ↗

getGitHubAppClientIDCodemod creates a codemod that migrates github-app.app-id to github-app.client-id.

()

Source from the content-addressed store, hash-verified

11
12// getGitHubAppClientIDCodemod creates a codemod that migrates github-app.app-id to github-app.client-id.
13func getGitHubAppClientIDCodemod() Codemod {
14 return Codemod{
15 ID: "github-app-app-id-to-client-id",
16 Name: "Rename 'github-app.app-id' to 'github-app.client-id'",
17 Description: "Renames deprecated 'app-id:' to 'client-id:' inside github-app blocks.",
18 IntroducedIn: "0.68.4",
19 Apply: func(content string, frontmatter map[string]any) (string, bool, error) {
20 if !hasDeprecatedGitHubAppIDField(frontmatter) {
21 return content, false, nil
22 }
23 newContent, applied, err := applyFrontmatterLineTransform(content, renameGitHubAppIDToClientID)
24 if applied {
25 githubAppClientIDCodemodLog.Print("Renamed github-app app-id to client-id")
26 }
27 return newContent, applied, err
28 },
29 }
30}
31
32// hasDeprecatedGitHubAppIDField returns true when any github-app object contains app-id.
33func hasDeprecatedGitHubAppIDField(frontmatter map[string]any) bool {

Callers 2

GetAllCodemodsFunction · 0.85

Calls 3

PrintMethod · 0.80

Tested by 1