You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# - Initialize-SharedTestRepositoryExtras org-only `-2` and `-3` companion repositories used by Secrets/Variables tests
1
+
<#
2
+
.SYNOPSIS
3
+
Idempotent get-or-create helpers for the shared run-scoped test repositories.
4
+
5
+
.DESCRIPTION
6
+
The integration test suite uses a small set of GitHub repositories whose names are
7
+
scoped to the current `GITHUB_RUN_ID` and shared across the leaf jobs in the
8
+
`Test-ModuleLocal` matrix. Any leaf job that depends on these repositories calls
9
+
the helpers in this file from its `BeforeAll` block to ensure the repositories
10
+
are present before the tests execute.
11
+
12
+
The helpers are declarative: they fetch the repository if it already exists and
13
+
create it if it does not. This keeps test setup independent of the order in which
14
+
jobs run, makes individual tests safe to execute in isolation, and lets the
15
+
suite recover when shared infrastructure is missing for any reason.
16
+
17
+
Naming and scope are owned by the caller. The helpers do not list, rename, or
18
+
delete repositories, and they do not widen ownership beyond the names they are
19
+
given.
20
+
21
+
.NOTES
22
+
Functions:
23
+
- Initialize-SharedTestRepository Primary `Test-{OS}-{TokenType}-{RunID}` repository, initialized with a readme, license, and gitignore so a default branch with content is available.
24
+
- Initialize-SharedTestRepositoryExtras Companion `-2` and `-3` repositories used by organization-scoped Secrets/Variables `SelectedRepository` tests.
25
+
#>
24
26
25
27
functionInitialize-SharedTestRepository {
28
+
<#
29
+
.SYNOPSIS
30
+
Returns the named shared test repository, creating it if it does not exist.
31
+
32
+
.DESCRIPTION
33
+
Looks up the repository by name in the given owner scope and returns it if
34
+
found. If it is not found, creates it with a readme, MIT license, and
35
+
VisualStudio gitignore so release-related tests have a default branch with
36
+
content to operate on. If creation races with a parallel caller, the
37
+
repository is re-fetched and returned.
38
+
#>
26
39
[CmdletBinding()]
27
40
[OutputType([object])]
28
41
param(
42
+
# Login of the user or organization that owns the repository.
29
43
[Parameter(Mandatory)]
30
44
[string] $Owner,
31
45
46
+
# Whether $Owner is a user account or an organization. Determines which
47
+
# Get-/New-GitHubRepository parameter set is used.
Write-Host"Shared test repository '$Name' not found for owner '$Owner' ($OwnerType). Creating it now (self-heal path for partial reruns / issue #590)."
66
+
Write-Host"Provisioning shared test repository '$Owner/$Name' ($OwnerType)."
54
67
55
-
# The primary shared repository is initialized with readme/license/gitignore so
56
-
# release tests have a default branch with content available for tag operations.
57
68
$createParams=@{
58
69
Name=$Name
59
70
AddReadme=$true
@@ -67,9 +78,9 @@ function Initialize-SharedTestRepository {
0 commit comments