File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -573,6 +573,7 @@ Describe 'API' {
573573 Write-Host ($context | Format-List | Out-String )
574574 }
575575 $context | Should -Not - BeNullOrEmpty
576+ $appContext = $context
576577 if ($AuthType -eq ' APP' ) {
577578 $context = Connect-GitHubApp @connectAppParams - PassThru - Default - Silent
578579 LogGroup ' Context - Installation' {
@@ -587,7 +588,7 @@ Describe 'API' {
587588
588589 It ' Invoke-GitHubAPI - Gets the app details' - Skip:($AuthType -ne ' APP' ) {
589590 {
590- $app = Invoke-GitHubAPI - ApiEndpoint ' /app'
591+ $app = Invoke-GitHubAPI - ApiEndpoint ' /app' - Context $appContext
591592 LogGroup ' App' {
592593 Write-Host ($app | Format-List | Out-String )
593594 }
Original file line number Diff line number Diff line change @@ -23,6 +23,9 @@ BeforeAll {
2323 $testName = ' Organizations'
2424 $os = $env: RUNNER_OS
2525 $id = $env: GITHUB_RUN_ID
26+ if (-not $id ) {
27+ throw ' GITHUB_RUN_ID is required to safely scope pre-test cleanup in Organizations.Tests.ps1.'
28+ }
2629}
2730
2831Describe ' Organizations' {
Original file line number Diff line number Diff line change @@ -146,7 +146,7 @@ Describe 'TestName' {
146146| Resource | Pattern | Example |
147147| ------------| ----------------------------------------------| ----------------------------------|
148148| Repo | ` Test-{OS}-{TokenType}-{RunID} ` | ` Test-Linux-USER_FG_PAT-1234 ` |
149- | Extra repo | ` Test-{OS}-{TokenType}-{RunID}-{N} ` | ` Test-Linux-USER_FG_PAT-1234-1 ` |
149+ | Extra repo | ` Test-{OS}-{TokenType}-{RunID}-{N} ` | ` Test-Linux-USER_FG_PAT-1234-2 ` |
150150| Secret | ` {TestName}_{OS}_{TokenType}_{RunID} ` | ` Secrets_Linux_PAT_1234 ` |
151151| Variable | ` {TestName}_{OS}_{TokenType}_{RunID} ` | ` Variables_Linux_PAT_1234 ` |
152152| Team | ` {TestName}_{OS}_{TokenType}_{RunID}_{Name} ` | ` Teams_Linux_APP_ORG_1234_Pull ` |
Original file line number Diff line number Diff line change @@ -23,6 +23,9 @@ BeforeAll {
2323 $testName = ' Repositories'
2424 $os = $env: RUNNER_OS
2525 $id = $env: GITHUB_RUN_ID
26+ if (-not $id ) {
27+ throw ' GITHUB_RUN_ID is required for Repositories tests because cleanup removes repositories and teams by name prefix.'
28+ }
2629}
2730
2831Describe ' Repositories' {
Original file line number Diff line number Diff line change @@ -23,6 +23,9 @@ BeforeAll {
2323 $testName = ' Secrets'
2424 $os = $env: RUNNER_OS
2525 $id = $env: GITHUB_RUN_ID
26+ if (-not $id ) {
27+ throw ' GITHUB_RUN_ID is required for Secrets tests because secret cleanup uses run-scoped wildcard names.'
28+ }
2629}
2730
2831Describe ' Secrets' {
Original file line number Diff line number Diff line change @@ -23,6 +23,9 @@ BeforeAll {
2323 $testName = ' Teams'
2424 $os = $env: RUNNER_OS
2525 $id = $env: GITHUB_RUN_ID
26+ if (-not $id ) {
27+ throw ' GITHUB_RUN_ID is not set. Refusing to run Teams tests cleanup without a scoped run ID.'
28+ }
2629}
2730
2831Describe ' Teams' {
Original file line number Diff line number Diff line change @@ -23,6 +23,9 @@ BeforeAll {
2323 $testName = ' Variables'
2424 $os = $env: RUNNER_OS
2525 $id = $env: GITHUB_RUN_ID
26+ if (-not $id ) {
27+ throw ' GITHUB_RUN_ID is not set. Skipping Variables tests to avoid deleting variables from other runs.'
28+ }
2629}
2730
2831Describe ' Variables' {
You can’t perform that action at this time.
0 commit comments