File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -79,7 +79,12 @@ Describe 'Organizations' {
7979 # GITHUB_RUN_ATTEMPT remain idempotent.
8080 $staleOrgs = @ ()
8181 foreach ($candidateName in $orgNamesToCheck ) {
82- $candidateOrg = Get-GitHubOrganization - Name $candidateName - ErrorAction SilentlyContinue
82+ try {
83+ $candidateOrg = Get-GitHubOrganization - Name $candidateName - ErrorAction SilentlyContinue
84+ } catch {
85+ Write-Host " Could not inspect candidate stale org [$candidateName ]: $ ( $_.Exception.Message ) "
86+ continue
87+ }
8388 if ($candidateOrg -and $candidateOrg.Name ) {
8489 $staleOrgs += $candidateOrg
8590 }
@@ -303,7 +308,24 @@ Describe 'Organizations' {
303308 It ' Remove-GitHubOrganizationInvitation - Removes a user invitation from an organization' {
304309 {
305310 $invitation = Get-GitHubOrganizationPendingInvitation - Organization $owner | Select-Object - First 1
306- Remove-GitHubOrganizationInvitation - Organization $owner - ID $invitation.id
311+ $maxAttempts = 5
312+ $retryDelay = 3
313+ for ($retryAttempt = 1 ; $retryAttempt -le $maxAttempts ; $retryAttempt ++ ) {
314+ try {
315+ Remove-GitHubOrganizationInvitation - Organization $owner - ID $invitation.id - ErrorAction Stop
316+ break
317+ } catch {
318+ if (
319+ $retryAttempt -lt $maxAttempts -and
320+ $_.Exception.Message -match ' 502'
321+ ) {
322+ Write-Host " Remove-GitHubOrganizationInvitation attempt $retryAttempt /$maxAttempts failed: $ ( $_.Exception.Message ) . Retrying in ${retryDelay} s..."
323+ Start-Sleep - Seconds $retryDelay
324+ } else {
325+ throw
326+ }
327+ }
328+ }
307329 } | Should -Not - Throw
308330 }
309331 }
You can’t perform that action at this time.
0 commit comments