From a8636447c1a182255abb4deb56701c6874b94b19 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 10 Feb 2026 10:41:49 +0000 Subject: [PATCH 1/4] Initial plan From e7470d9e96df7a6c6e1cbb293309a808961261bf Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 10 Feb 2026 10:43:46 +0000 Subject: [PATCH 2/4] Add branch deletion for superseded Auto-Update PRs Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com> --- scripts/Update-FontsData.ps1 | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/scripts/Update-FontsData.ps1 b/scripts/Update-FontsData.ps1 index fa708a5..f4f5d4d 100644 --- a/scripts/Update-FontsData.ps1 +++ b/scripts/Update-FontsData.ps1 @@ -161,7 +161,7 @@ LogGroup 'Process changes' { Write-Output "Found new PR #$($newPR.number): $($newPR.title)" # Find existing open Auto-Update PRs (excluding the one we just created) - $existingPRsJson = Run gh pr list --repo $repoName --state open --search 'Auto-Update in:title' --json 'number,title' + $existingPRsJson = Run gh pr list --repo $repoName --state open --search 'Auto-Update in:title' --json 'number,title,headRefName' $existingPRs = $existingPRsJson | ConvertFrom-Json | Where-Object { $_.number -ne $newPR.number } if ($existingPRs) { @@ -181,6 +181,16 @@ The font data has been updated in the newer PR. Please refer to #$($newPR.number Run gh pr close $pr.number --repo $repoName Write-Output "Successfully closed PR #$($pr.number)" + + # Delete the branch associated with the closed PR + $branchName = $pr.headRefName + if ($branchName) { + Write-Output "Deleting branch: $branchName" + Run gh api -X DELETE "repos/$repoName/git/refs/heads/$branchName" + Write-Output "Successfully deleted branch: $branchName" + } else { + Write-Warning "Could not determine branch name for PR #$($pr.number)" + } } } else { Write-Output 'No existing open Auto-Update PRs to close.' From 4333a1bc8853e6dcf5705484349a866779faed6a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 10 Feb 2026 10:44:19 +0000 Subject: [PATCH 3/4] Add error handling for branch deletion Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com> --- scripts/Update-FontsData.ps1 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/Update-FontsData.ps1 b/scripts/Update-FontsData.ps1 index f4f5d4d..e4531de 100644 --- a/scripts/Update-FontsData.ps1 +++ b/scripts/Update-FontsData.ps1 @@ -186,8 +186,12 @@ The font data has been updated in the newer PR. Please refer to #$($newPR.number $branchName = $pr.headRefName if ($branchName) { Write-Output "Deleting branch: $branchName" - Run gh api -X DELETE "repos/$repoName/git/refs/heads/$branchName" - Write-Output "Successfully deleted branch: $branchName" + try { + Run gh api -X DELETE "repos/$repoName/git/refs/heads/$branchName" + Write-Output "Successfully deleted branch: $branchName" + } catch { + Write-Warning "Failed to delete branch $branchName : $_" + } } else { Write-Warning "Could not determine branch name for PR #$($pr.number)" } From e4d80b189fa151bf9a9e28002713f23e407c3636 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Tue, 10 Feb 2026 12:21:36 +0100 Subject: [PATCH 4/4] =?UTF-8?q?=F0=9F=A9=B9=20[Fix]:=20Improve=20branch=20?= =?UTF-8?q?deletion=20error=20handling=20in=20Update-FontsData=20script?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/Update-FontsData.ps1 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/Update-FontsData.ps1 b/scripts/Update-FontsData.ps1 index e4531de..88d5d62 100644 --- a/scripts/Update-FontsData.ps1 +++ b/scripts/Update-FontsData.ps1 @@ -186,11 +186,11 @@ The font data has been updated in the newer PR. Please refer to #$($newPR.number $branchName = $pr.headRefName if ($branchName) { Write-Output "Deleting branch: $branchName" - try { - Run gh api -X DELETE "repos/$repoName/git/refs/heads/$branchName" + $null = Run gh api -X DELETE "repos/$repoName/git/refs/heads/$branchName" + if ($LASTEXITCODE -eq 0) { Write-Output "Successfully deleted branch: $branchName" - } catch { - Write-Warning "Failed to delete branch $branchName : $_" + } else { + Write-Warning "Failed to delete branch $branchName (exit code $LASTEXITCODE)" } } else { Write-Warning "Could not determine branch name for PR #$($pr.number)"