File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,6 +19,9 @@ BeforeAll {
1919 $testName = ' Actions'
2020 $os = $env: RUNNER_OS
2121 $id = $env: GITHUB_RUN_ID
22+ if (-not $id ) {
23+ throw ' GITHUB_RUN_ID is required for Actions tests because it is used to build repository-scoped names for OIDC operations.'
24+ }
2225}
2326
2427Describe ' Actions' {
@@ -59,6 +62,9 @@ Describe 'Actions' {
5962 $repo = $null
6063 } else {
6164 $repo = Get-GitHubRepository - Owner $Owner - Name $repoName
65+ if (-not $repo ) {
66+ throw " Shared test repository '$repoName ' was not found for owner '$Owner ' (OwnerType: '$OwnerType '). Ensure the repository was provisioned and the repository name is correct."
67+ }
6268 Write-Host ($repo | Select-Object * | Out-String )
6369 }
6470 }
Original file line number Diff line number Diff line change @@ -23,6 +23,9 @@ BeforeAll {
2323 $testName = ' Environments'
2424 $os = $env: RUNNER_OS
2525 $id = $env: GITHUB_RUN_ID
26+ if (-not $id ) {
27+ throw ' GITHUB_RUN_ID is required for Environments tests.'
28+ }
2629}
2730
2831Describe ' Environments' {
@@ -46,6 +49,9 @@ Describe 'Environments' {
4649
4750 LogGroup " Using Repository - [$repoName ]" {
4851 $repo = Get-GitHubRepository - Owner $Owner - Name $repoName
52+ if (($OwnerType -notin (' repository' , ' enterprise' )) -and (-not $repo )) {
53+ throw " Shared test repository '$repoName ' was not found for owner '$Owner '. Ensure the repository was created before running the environment tests."
54+ }
4955 Write-Host ($repo | Select-Object * | Out-String )
5056 }
5157 }
Original file line number Diff line number Diff line change @@ -23,6 +23,9 @@ BeforeAll {
2323 $testName = ' Releases'
2424 $os = $env: RUNNER_OS
2525 $id = $env: GITHUB_RUN_ID
26+ if (-not $id ) {
27+ throw ' GITHUB_RUN_ID must be set for run-scoped release tests.'
28+ }
2629}
2730
2831Describe ' Releases' {
@@ -45,6 +48,9 @@ Describe 'Releases' {
4548
4649 LogGroup " Using Repository - [$repoName ]" {
4750 $repo = Get-GitHubRepository - Owner $Owner - Name $repoName
51+ if (-not $repo ) {
52+ throw " Expected shared test repository '$Owner /$repoName ' was not found. Get-GitHubRepository returned no result, so release tests cannot continue."
53+ }
4854 Write-Host ($repo | Select-Object * | Out-String )
4955 }
5056 }
Original file line number Diff line number Diff line change @@ -44,19 +44,18 @@ Describe 'Teams' {
4444 }
4545 }
4646 $teamPrefix = " $testName `_$os `_$TokenType `_$id "
47- $teamName = $teamPrefix
4847
4948 switch ($OwnerType ) {
5049 ' organization' {
51- Get-GitHubTeam - Organization $owner | Where-Object { $_.Name -like " $teamName *" } | Remove-GitHubTeam - Confirm:$false
50+ Get-GitHubTeam - Organization $owner | Where-Object { $_.Name -like " $teamPrefix *" } | Remove-GitHubTeam - Confirm:$false
5251 }
5352 }
5453 }
5554
5655 AfterAll {
5756 switch ($OwnerType ) {
5857 ' organization' {
59- $teamsToRemove = Get-GitHubTeam - Organization $owner | Where-Object { $_.Name -like " $teamName *" }
58+ $teamsToRemove = Get-GitHubTeam - Organization $owner | Where-Object { $_.Name -like " $teamPrefix *" }
6059 LogGroup ' Teams to remove' {
6160 Write-Host " $ ( $teamsToRemove | Format-List | Out-String ) "
6261 }
You can’t perform that action at this time.
0 commit comments