Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -86,23 +86,26 @@ filter Get-GitHubEnvironmentByName {
Uri = $Context.ApiBaseUri + "/repos/$Owner/$Repository/environments/$encodedName"
Context = $Context
}

Invoke-GitHubAPI @inputObject | ForEach-Object {
Write-Output $_.Response | ForEach-Object {
[GitHubEnvironment]@{
Name = $_.name
DatabaseID = $_.id
NodeID = $_.node_id
Url = $_.html_url
Owner = $Owner
Repository = $Repository
CreatedAt = $_.created_at
UpdatedAt = $_.updated_at
CanAdminsBypass = $_.can_admins_bypass
ProtectionRules = $_.protection_rules
DeploymentBranchPolicy = $_.deployment_branch_policy
try {
Invoke-GitHubAPI @inputObject | ForEach-Object {
Write-Output $_.Response | ForEach-Object {
[GitHubEnvironment]@{
Name = $_.name
DatabaseID = $_.id
NodeID = $_.node_id
Url = $_.html_url
Owner = $Owner
Repository = $Repository
CreatedAt = $_.created_at
UpdatedAt = $_.updated_at
CanAdminsBypass = $_.can_admins_bypass
ProtectionRules = $_.protection_rules
DeploymentBranchPolicy = $_.deployment_branch_policy
}
}
}
} catch {
return
}
}

Expand Down
8 changes: 6 additions & 2 deletions src/functions/public/Environments/Get-GitHubEnvironment.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,12 @@ filter Get-GitHubEnvironment {
}

process {
Get-GitHubEnvironmentList -Owner $Owner -Repository $Repository -PerPage $PerPage -Context $Context |
Where-Object { $_.Name -like $Name }
if ($Name.Contains('*')) {
Get-GitHubEnvironmentList -Owner $Owner -Repository $Repository -PerPage $PerPage -Context $Context |
Where-Object { $_.Name -like $Name }
} else {
Get-GitHubEnvironmentByName -Owner $Owner -Repository $Repository -Name $Name -Context $Context
}
}

end {
Expand Down
Loading