diff --git a/modules/WingetMaintainerModule/Public/Test-ExistingPRs.ps1 b/modules/WingetMaintainerModule/Public/Test-ExistingPRs.ps1 index 4f34fe4..95ba350 100644 --- a/modules/WingetMaintainerModule/Public/Test-ExistingPRs.ps1 +++ b/modules/WingetMaintainerModule/Public/Test-ExistingPRs.ps1 @@ -30,12 +30,18 @@ function Test-ExistingPRs { param( [Parameter(Mandatory = $true)] [string] $Version, - [Parameter(Mandatory = $false)] [string] $PackageIdentifier = ${Env:PackageName} + [Parameter(Mandatory = $false)] [string] $PackageIdentifier = ${Env:PackageName}, + [Parameter(Mandatory = $false)] [switch] $OnlyOpen ) Write-Host "Checking for existing PRs for $PackageIdentifier $Version" $ExistingOpenPRs = gh pr list --search "$($PackageIdentifier) $($Version) in:title draft:false" --state 'open' --json 'title,url' --repo 'microsoft/winget-pkgs' | ConvertFrom-Json + if(!$OnlyOpen) { $ExistingMergedPRs = gh pr list --search "$($PackageIdentifier) $($Version) in:title draft:false" --state 'merged' --json 'title,url' --repo 'microsoft/winget-pkgs' | ConvertFrom-Json - $ExistingPRs = @($ExistingOpenPRs) + @($ExistingMergedPRs) + $ExistingPRs = @($ExistingOpenPRs) + @($ExistingMergedPRs) + } + else { + $ExistingPRs = @($ExistingOpenPRs) + } if ($ExistingPRs.Count -gt 0) { $ExistingPRs | ForEach-Object { diff --git a/scripts/Update-AllPackageManifests.ps1 b/scripts/Update-AllPackageManifests.ps1 index c001c7f..18cbf33 100644 --- a/scripts/Update-AllPackageManifests.ps1 +++ b/scripts/Update-AllPackageManifests.ps1 @@ -82,7 +82,7 @@ function Update-WingetPackage { $manifest = $manifestDict[$version] # Extract the installer links from the manifest $installerLinks = Export-InstallerLinks -Manifest $manifest - $prExists = Test-ExistingPRs -PackageIdentifier $PackageIdentifier -Version $version + $prExists = Test-ExistingPRs -PackageIdentifier $PackageIdentifier -Version $version -OnlyOpen if(!$prExists || $Submit -eq $false) { .\komac.exe update $PackageIdentifier --version $version --urls $installerLinks -o $OutputDir -t $Token ($Submit -eq $true ? '-s' : '--dry-run') ($resolves -match '^\d+$' ? "--resolves $resolves" : $null ) }