Skip to content

Commit fc43af8

Browse files
Route global BeforeAll through SharedTestRepositories helpers
1 parent b1cb3fd commit fc43af8

1 file changed

Lines changed: 7 additions & 20 deletions

File tree

tests/BeforeAll.ps1

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ param()
33

44
LogGroup 'BeforeAll - Global Test Setup' {
55
$authCases = . "$PSScriptRoot/Data/AuthCases.ps1"
6+
. "$PSScriptRoot/Data/SharedTestRepositories.ps1"
67
$id = $env:GITHUB_RUN_ID
78
if (-not $id) {
89
throw 'GITHUB_RUN_ID environment variable is not set. Refusing to create or clean up test repositories with a non-deterministic name.'
@@ -67,29 +68,15 @@ LogGroup 'BeforeAll - Global Test Setup' {
6768
}
6869
}
6970

70-
# Create the primary shared repository (with readme, license, gitignore for release tests).
71-
$repoParams = @{
72-
Name = $repoName
73-
AddReadme = $true
74-
License = 'mit'
75-
Gitignore = 'VisualStudio'
76-
}
77-
switch ($OwnerType) {
78-
'user' {
79-
New-GitHubRepository @repoParams
80-
}
81-
'organization' {
82-
New-GitHubRepository @repoParams -Organization $Owner
83-
}
84-
}
71+
# Provision the primary shared repository via the same idempotent helper that
72+
# leaf jobs use, so the happy-path BeforeAll and the partial-rerun self-heal
73+
# path (issue #590) follow the same code.
74+
Initialize-SharedTestRepository -Owner $Owner -OwnerType $OwnerType -Name $repoName | Out-Null
8575

86-
# Create extra repositories needed by Secrets/Variables SelectedRepository tests.
76+
# Provision extra repositories needed by Secrets/Variables SelectedRepository tests.
8777
# Only organization owners need them — those tests are skipped for user owners.
8878
if ($OwnerType -eq 'organization') {
89-
foreach ($suffix in 2, 3) {
90-
$extraName = "$repoName-$suffix"
91-
New-GitHubRepository -Organization $Owner -Name $extraName
92-
}
79+
Initialize-SharedTestRepositoryExtras -Owner $Owner -BaseName $repoName | Out-Null
9380
}
9481
}
9582
}

0 commit comments

Comments
 (0)