Skip to content

Commit

Permalink
improve PR check
Browse files Browse the repository at this point in the history
  • Loading branch information
Utesgui authored Apr 22, 2024
1 parent 787dcf7 commit 1b5dae4
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 6 deletions.
5 changes: 4 additions & 1 deletion Scripts/Update-Glarysoft.GlaryUtilities.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ if ($wingetVersions -contains $latestVersion) {
}
else {
# Check for existing PRs
$ExistingPRs = gh pr list --search "$($wingetPackage) version $($latestVersion) in:title draft:false" --state 'all' --json 'title,url' --repo 'microsoft/winget-pkgs' | ConvertFrom-Json
$ExistingOpenPRs = gh pr list --search "$($wingetPackage) $($latestVersion) in:title draft:false" --state 'open' --json 'title,url' --repo 'microsoft/winget-pkgs' | ConvertFrom-Json
$ExistingMergedPRs = gh pr list --search "$($wingetPackage) $($latestVersion) in:title draft:false" --state 'merged' --json 'title,url' --repo 'microsoft/winget-pkgs' | ConvertFrom-Json

$ExistingPRs = $ExistingOpenPRs += $ExistingMergedPRs

# TODO Check if PR is already merged, if so exit

Expand Down
4 changes: 3 additions & 1 deletion Scripts/Update-Logitech.OptionsPlus.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ if ($wingetVersions -contains $latestVersion) {
}
else {
# Check for existing PRs
$ExistingPRs = gh pr list --search "$($wingetPackage) version $($latestVersion) in:title draft:false" --state 'all' --json 'title,url' --repo 'microsoft/winget-pkgs' | ConvertFrom-Json
$ExistingOpenPRs = gh pr list --search "$($wingetPackage) $($latestVersion) in:title draft:false" --state 'open' --json 'title,url' --repo 'microsoft/winget-pkgs' | ConvertFrom-Json
$ExistingMergedPRs = gh pr list --search "$($wingetPackage) $($latestVersion) in:title draft:false" --state 'merged' --json 'title,url' --repo 'microsoft/winget-pkgs' | ConvertFrom-Json

$ExistingPRs = $ExistingOpenPRs += $ExistingMergedPRs
# TODO Check if PR is already merged, if so exit

# TODO if PR from us is already open, update PR with new version
Expand Down
7 changes: 5 additions & 2 deletions Scripts/Update-Loupedeck.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,11 @@ if ($fullDownloadURLResponse.StatusCode -ne 200) {
exit 1
}

# Check for existing PRs
$ExistingPRs = gh pr list --search "$($wingetPackage) version $($versionInfo) in:title draft:false" --state 'all' --json 'title,url' --repo 'microsoft/winget-pkgs' | ConvertFrom-Json
# Check for existing PRs
$ExistingOpenPRs = gh pr list --search "$($wingetPackage) $($latestVersion) in:title draft:false" --state 'open' --json 'title,url' --repo 'microsoft/winget-pkgs' | ConvertFrom-Json
$ExistingMergedPRs = gh pr list --search "$($wingetPackage) $($latestVersion) in:title draft:false" --state 'merged' --json 'title,url' --repo 'microsoft/winget-pkgs' | ConvertFrom-Json

$ExistingPRs = $ExistingOpenPRs += $ExistingMergedPRs

if ($wingetVersions -and ($wingetVersions -notmatch $versionInfo) -and ($ExistingPRs.Count -eq 0)) {
$prMessage = "Update version: $wingetPackage version $versionInfo"
Expand Down
5 changes: 4 additions & 1 deletion Scripts/Update-QFlipper.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@ if ($wingetVersions -contains $latestVersionDirectory) {
}
else {
# Check for existing PRs
$ExistingPRs = gh pr list --search "$($wingetPackage) version $($latestVersionDirectory) in:title draft:false" --state 'all' --json 'title,url' --repo 'microsoft/winget-pkgs' | ConvertFrom-Json
$ExistingOpenPRs = gh pr list --search "$($wingetPackage) $($latestVersion) in:title draft:false" --state 'open' --json 'title,url' --repo 'microsoft/winget-pkgs' | ConvertFrom-Json
$ExistingMergedPRs = gh pr list --search "$($wingetPackage) $($latestVersion) in:title draft:false" --state 'merged' --json 'title,url' --repo 'microsoft/winget-pkgs' | ConvertFrom-Json

$ExistingPRs = $ExistingOpenPRs += $ExistingMergedPRs

if ($ExistingPRs.Count -gt 0) {
Write-Output "$foundMessage"
$ExistingPRs | ForEach-Object {
Expand Down
5 changes: 4 additions & 1 deletion Scripts/Update-gitbutler.GitButler.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,11 @@ if ($wingetVersions -contains $latestVersion) {
}
else {
# Check for existing PRs
$ExistingPRs = gh pr list --search "$($wingetPackage) version $($latestVersion) in:title draft:false" --state 'all' --json 'title,url' --repo 'microsoft/winget-pkgs' | ConvertFrom-Json
$ExistingOpenPRs = gh pr list --search "$($wingetPackage) $($latestVersion) in:title draft:false" --state 'open' --json 'title,url' --repo 'microsoft/winget-pkgs' | ConvertFrom-Json
$ExistingMergedPRs = gh pr list --search "$($wingetPackage) $($latestVersion) in:title draft:false" --state 'merged' --json 'title,url' --repo 'microsoft/winget-pkgs' | ConvertFrom-Json

$ExistingPRs = $ExistingOpenPRs += $ExistingMergedPRs

# TODO Check if PR is already merged, if so exit

# TODO if PR from us is already open, update PR with new version
Expand Down

0 comments on commit 1b5dae4

Please sign in to comment.