Simplify conditional logic for better readability

Co-authored-by: DRSDavidSoft <4673812+DRSDavidSoft@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-11-07 14:40:21 +00:00
parent aa6b28a2b0
commit 73739407b1

View File

@@ -161,12 +161,10 @@ function Fetch-DownloadUrl {
:loop foreach ($i in $info) { :loop foreach ($i in $info) {
# Skip pre-release versions unless explicitly included # Skip pre-release versions unless explicitly included
# Pre-releases include RC (Release Candidate), beta, alpha, and other test versions # Pre-releases include RC (Release Candidate), beta, alpha, and other test versions
if (-not $includePrerelease) { if (-not $includePrerelease -and (Test-IsPrerelease $i)) {
if (Test-IsPrerelease $i) {
Write-Verbose "Skipping pre-release version: $($i.tag_name)" Write-Verbose "Skipping pre-release version: $($i.tag_name)"
continue continue
} }
}
if (-not ($i.assets -is [array])) { if (-not ($i.assets -is [array])) {
continue continue
@@ -210,11 +208,9 @@ function Fetch-DownloadUrl {
$selectedRelease = $null $selectedRelease = $null
foreach ($release in $info) { foreach ($release in $info) {
# Apply the same filtering logic # Apply the same filtering logic
if (-not $includePrerelease) { if (-not $includePrerelease -and (Test-IsPrerelease $release)) {
if (Test-IsPrerelease $release) {
continue continue
} }
}
# Use the first release that passes the filter # Use the first release that passes the filter
$selectedRelease = $release $selectedRelease = $release
break break