Fix username validation and skip ci tests properly

This commit is contained in:
Viktor Liu
2025-07-03 14:33:56 +02:00
parent aa30b7afe8
commit 088956645f
4 changed files with 97 additions and 32 deletions

View File

@@ -744,16 +744,17 @@ func getTestUsername(t *testing.T) string {
// isCI checks if we're running in a CI environment
func isCI() bool {
ciEnvVars := []string{
"CI", "CONTINUOUS_INTEGRATION", "GITHUB_ACTIONS",
"GITLAB_CI", "JENKINS_URL", "BUILDKITE", "CIRCLECI",
// Check standard CI environment variables
if os.Getenv("GITHUB_ACTIONS") == "true" || os.Getenv("CI") == "true" {
return true
}
for _, envVar := range ciEnvVars {
if os.Getenv(envVar) != "" {
return true
}
// Check for GitHub Actions runner hostname pattern (when running as SYSTEM)
hostname, err := os.Hostname()
if err == nil && strings.HasPrefix(hostname, "runner") {
return true
}
return false
}