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

Function updateRequiredRuntime

pkg/workflow/runtime_detection.go:263–291  ·  view source on GitHub ↗

updateRequiredRuntime updates the version requirement, choosing the highest version

(runtime *Runtime, newVersion string, requirements map[string]*RuntimeRequirement)

Source from the content-addressed store, hash-verified

261
262// updateRequiredRuntime updates the version requirement, choosing the highest version
263func updateRequiredRuntime(runtime *Runtime, newVersion string, requirements map[string]*RuntimeRequirement) {
264 existing, exists := requirements[runtime.ID]
265
266 if !exists {
267 runtimeSetupLog.Printf("Adding new runtime requirement: %s (version=%s)", runtime.ID, newVersion)
268 requirements[runtime.ID] = &RuntimeRequirement{
269 Runtime: runtime,
270 Version: newVersion,
271 Cooldown: true,
272 }
273 return
274 }
275
276 // If new version is empty, keep existing
277 if newVersion == "" {
278 return
279 }
280
281 // If existing version is empty, use new version
282 if existing.Version == "" {
283 existing.Version = newVersion
284 return
285 }
286
287 // Compare versions and keep the higher one
288 if semverutil.Compare(newVersion, existing.Version) > 0 {
289 existing.Version = newVersion
290 }
291}
292
293// standardGitHubHostedRunners is the allowlist of known runner labels that
294// ship with Node.js pre-installed. Only exact labels (case-insensitive) listed here are

Callers 5

detectRuntimeFromCommandFunction · 0.85
detectFromMCPConfigsFunction · 0.85
detectFromMCPScriptsFunction · 0.85
detectFromLSPServersFunction · 0.85

Calls 2

CompareFunction · 0.92
PrintfMethod · 0.45

Tested by

no test coverage detected