getGitHubAppClientIDCodemod creates a codemod that migrates github-app.app-id to github-app.client-id.
()
| 11 | |
| 12 | // getGitHubAppClientIDCodemod creates a codemod that migrates github-app.app-id to github-app.client-id. |
| 13 | func 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. |
| 33 | func hasDeprecatedGitHubAppIDField(frontmatter map[string]any) bool { |