Skip to content

Commit 916f0b0

Browse files
Address review feedback: separate org prefix variables and use -Enterprise for discovery
- Use separate variable \ for the run-scoped prefix in cleanup block to avoid mutating \ which is used later in tests - Add -Enterprise \ parameter to Get-GitHubOrganization calls to properly enumerate enterprise-owned orgs for discovery and current org lookup
1 parent b22c2aa commit 916f0b0

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

tests/Organizations.Tests.ps1

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,15 @@ Describe 'Organizations' {
6262
# On reruns, clean up any orgs matching the base run prefix (e.g., ...-1234,
6363
# ...-1234-2, etc.) before creating a new one. This prevents orphaned orgs
6464
# from failed previous attempts.
65-
$orgPrefix = "$testName-$os-$runId"
66-
Write-Host "Searching for stale orgs matching prefix: $orgPrefix*"
65+
$orgRunPrefix = "$testName-$os-$runId"
66+
Write-Host "Searching for stale orgs matching prefix: $orgRunPrefix*"
6767

68-
# Collect all orgs that match the base run prefix pattern
69-
$staleOrgs = Get-GitHubOrganization -ErrorAction SilentlyContinue |
70-
Where-Object { $_.Name -like "$orgPrefix*" -and $_.Name -ne $orgName }
68+
# Collect all orgs that match the base run prefix pattern (scoped to this enterprise)
69+
$staleOrgs = Get-GitHubOrganization -Enterprise $owner -ErrorAction SilentlyContinue |
70+
Where-Object { $_.Name -like "$orgRunPrefix*" -and $_.Name -ne $orgName }
7171

7272
# Also check for the current org name in case it exists from a failed attempt
73-
$currentOrg = Get-GitHubOrganization -Name $orgName -ErrorAction SilentlyContinue
73+
$currentOrg = Get-GitHubOrganization -Enterprise $owner -Name $orgName -ErrorAction SilentlyContinue
7474
if ($currentOrg -and $currentOrg.Name) {
7575
$staleOrgs += $currentOrg
7676
}
@@ -107,7 +107,7 @@ Describe 'Organizations' {
107107
}
108108
}
109109
} else {
110-
Write-Host "No stale orgs found matching prefix: $orgPrefix*"
110+
Write-Host "No stale orgs found matching prefix: $orgRunPrefix*"
111111
}
112112
}
113113
}

0 commit comments

Comments
 (0)