package checks import ( "path" "strings" ) // NeedsMacOS reports whether checking this change needs Apple's tools: // the change touches Swift, Objective-C or Xcode files, or the gate // itself calls Xcode's tools. A Linux runner cannot check those, so it // says so rather than pass or fail. func NeedsMacOS(changed []string, gateText string) bool { for _, f := range changed { switch strings.ToLower(path.Ext(f)) { case ".swift", ".m", ".mm", ".xib", ".storyboard", ".xcconfig", ".entitlements": return true } if strings.Contains(f, ".xcodeproj/") || strings.Contains(f, ".xcworkspace/") || path.Base(f) == "Package.swift" || path.Base(f) == "Podfile" { return true } } for _, tool := range []string{"xcodebuild", "xcrun", "swift build", "swift test", "fastlane"} { if strings.Contains(gateText, tool) { return true } } return false }