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

Function isCustomImageRunner

pkg/workflow/runtime_detection.go:340–355  ·  view source on GitHub ↗

isCustomImageRunner returns true if the runs-on configuration indicates a non-standard runner (custom image, self-hosted runner, or runner group). Custom image runners may not have Node.js pre-installed, so the compiler ensures Node.js is set up. Only the labels in standardGitHubHostedRunners are c

(runsOn string)

Source from the content-addressed store, hash-verified

338// - "runs-on:\n- self-hosted\n..." → array form → returns true
339// - "runs-on:\n group: ..." → object form → returns true
340func isCustomImageRunner(runsOn string) bool {
341 if runsOn == "" {
342 // Empty means the default "ubuntu-latest" will be applied — not a custom runner.
343 return false
344 }
345
346 const keyPrefix = "runs-on: "
347 if value, ok := strings.CutPrefix(runsOn, keyPrefix); ok {
348 // Single-line value: check the label against the known-standard allowlist.
349 value = strings.TrimSpace(strings.ToLower(value))
350 return !standardGitHubHostedRunners[value]
351 }
352
353 // Multi-line value (array or object form) — always treat as custom image runner.
354 return true
355}

Callers 2

TestIsCustomImageRunnerFunction · 0.85

Calls 1

ToLowerMethod · 0.80

Tested by 1

TestIsCustomImageRunnerFunction · 0.68