|
3 | 3 |
|
4 | 4 | LogGroup 'BeforeAll - Global Test Setup' { |
5 | 5 | $authCases = . "$PSScriptRoot/Data/AuthCases.ps1" |
| 6 | + . "$PSScriptRoot/Data/SharedTestRepositories.ps1" |
6 | 7 | $id = $env:GITHUB_RUN_ID |
7 | 8 | if (-not $id) { |
8 | 9 | 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' { |
67 | 68 | } |
68 | 69 | } |
69 | 70 |
|
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 |
85 | 75 |
|
86 | | - # Create extra repositories needed by Secrets/Variables SelectedRepository tests. |
| 76 | + # Provision extra repositories needed by Secrets/Variables SelectedRepository tests. |
87 | 77 | # Only organization owners need them — those tests are skipped for user owners. |
88 | 78 | 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 |
93 | 80 | } |
94 | 81 | } |
95 | 82 | } |
|
0 commit comments