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

Function extractCompilerVersionFromWorkflowsDir

pkg/cli/upgrade_org.go:159–179  ·  view source on GitHub ↗

extractCompilerVersionFromWorkflowsDir reads the first .lock.yml file in workflowsDir and extracts the compiler_version from its gh-aw-metadata comment. Returns an empty string if no lock file is found or parsing fails.

(workflowsDir string)

Source from the content-addressed store, hash-verified

157// workflowsDir and extracts the compiler_version from its gh-aw-metadata
158// comment. Returns an empty string if no lock file is found or parsing fails.
159func extractCompilerVersionFromWorkflowsDir(workflowsDir string) string {
160 entries, err := os.ReadDir(workflowsDir)
161 if err != nil {
162 return ""
163 }
164 for _, e := range entries {
165 if e.IsDir() || !strings.HasSuffix(e.Name(), ".lock.yml") {
166 continue
167 }
168 lockPath := filepath.Join(workflowsDir, e.Name())
169 content, err := os.ReadFile(lockPath)
170 if err != nil {
171 continue
172 }
173 version := extractCompilerVersionFromLockContent(string(content))
174 if version != "" {
175 return version
176 }
177 }
178 return ""
179}
180
181// extractCompilerVersionFromLockContent parses the gh-aw-metadata JSON comment
182// from a lock file and returns the compiler_version field value.

Callers 1

scanUpgradeRepoFunction · 0.85

Tested by

no test coverage detected