From af8da23a517a5f6e8c339a9c19289427a7f7b5a1 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 8 Feb 2026 11:01:05 +0000 Subject: [PATCH 01/16] Initial plan From d6ff407a5237d6690daac69d1177eb079215221d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 8 Feb 2026 11:03:25 +0000 Subject: [PATCH 02/16] Implement PR supersedence for font data updater Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com> --- .github/workflows/Cleanup-FontsData-PRs.yml | 53 +++++++++++++++++++++ scripts/Update-FontsData.ps1 | 29 +++++++++++ 2 files changed, 82 insertions(+) create mode 100644 .github/workflows/Cleanup-FontsData-PRs.yml diff --git a/.github/workflows/Cleanup-FontsData-PRs.yml b/.github/workflows/Cleanup-FontsData-PRs.yml new file mode 100644 index 0000000..c81b2eb --- /dev/null +++ b/.github/workflows/Cleanup-FontsData-PRs.yml @@ -0,0 +1,53 @@ +name: Cleanup-FontsData-PRs + +on: + pull_request: + branches: + - main + types: + - closed + paths: + - 'src/FontsData.json' + +permissions: {} + +jobs: + Cleanup-Superseded-PRs: + name: Cleanup Superseded Font Data PRs + runs-on: ubuntu-latest + # Only run if the PR was merged (not just closed) + if: github.event.pull_request.merged == true + steps: + - name: Cleanup Superseded PRs + uses: PSModule/GitHub-Script@0097f3bbe3f413f3b577b9bcc600727b0ca3201a # v1.7.10 + with: + ClientID: ${{ secrets.GOOGLEFONTS_UPDATER_BOT_CLIENT_ID }} + PrivateKey: ${{ secrets.GOOGLEFONTS_UPDATER_BOT_PRIVATE_KEY }} + Script: | + Connect-GitHubApp -Organization 'PSModule' -Default + + Write-Output "Checking for remaining open Auto-Update PRs after merge..." + $existingPRs = Get-GitHubPullRequest -Owner 'PSModule' -Name 'GoogleFonts' -State 'open' | + Where-Object { $_.Title -like 'Auto-Update*' } + + if ($existingPRs) { + Write-Output "Found $($existingPRs.Count) existing Auto-Update PR(s) to close." + foreach ($pr in $existingPRs) { + Write-Output "Closing PR #$($pr.Number): $($pr.Title)" + + # Add a comment explaining the supersedence + $comment = @" + This PR has been superseded by PR #${{ github.event.pull_request.number }} which has been merged. + + The font data has been updated in the merged PR. This PR is now obsolete and will be closed automatically. + "@ + New-GitHubPullRequestComment -Owner 'PSModule' -Name 'GoogleFonts' -Number $pr.Number -Body $comment + + # Close the PR + Set-GitHubPullRequest -Owner 'PSModule' -Name 'GoogleFonts' -Number $pr.Number -State 'closed' + + Write-Output "Successfully closed PR #$($pr.Number)" + } + } else { + Write-Output "No remaining open Auto-Update PRs to close." + } diff --git a/scripts/Update-FontsData.ps1 b/scripts/Update-FontsData.ps1 index 6cf884d..6457938 100644 --- a/scripts/Update-FontsData.ps1 +++ b/scripts/Update-FontsData.ps1 @@ -120,6 +120,35 @@ LogGroup 'Process changes' { Run git push origin $targetBranch Write-Output "Changes committed and pushed to existing branch: $targetBranch" } else { + # Close any existing open Auto-Update PRs before creating a new one + LogGroup 'Close superseded PRs' { + Write-Output "Checking for existing open Auto-Update PRs..." + $existingPRs = Get-GitHubPullRequest -Owner 'PSModule' -Name 'GoogleFonts' -State 'open' | + Where-Object { $_.Title -like 'Auto-Update*' } + + if ($existingPRs) { + Write-Output "Found $($existingPRs.Count) existing Auto-Update PR(s) to close." + foreach ($pr in $existingPRs) { + Write-Output "Closing PR #$($pr.Number): $($pr.Title)" + + # Add a comment explaining the supersedence + $comment = @" +This PR has been superseded by a newer update and will be closed automatically. + +The font data has been updated in a more recent PR. Please refer to the latest Auto-Update PR for the most current changes. +"@ + New-GitHubPullRequestComment -Owner 'PSModule' -Name 'GoogleFonts' -Number $pr.Number -Body $comment + + # Close the PR + Set-GitHubPullRequest -Owner 'PSModule' -Name 'GoogleFonts' -Number $pr.Number -State 'closed' + + Write-Output "Successfully closed PR #$($pr.Number)" + } + } else { + Write-Output "No existing open Auto-Update PRs found." + } + } + Run git push --set-upstream origin $targetBranch Run gh pr create ` From 223424f85ab42a3f24e01603803a3c0c7aefae9d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 8 Feb 2026 11:03:52 +0000 Subject: [PATCH 03/16] Add documentation for font data updater and PR supersedence Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com> --- scripts/README.md | 100 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 scripts/README.md diff --git a/scripts/README.md b/scripts/README.md new file mode 100644 index 0000000..5d05c3b --- /dev/null +++ b/scripts/README.md @@ -0,0 +1,100 @@ +# Font Data Updater + +This directory contains scripts for automating the maintenance of the GoogleFonts module. + +## Update-FontsData.ps1 + +This script automatically updates the `src/FontsData.json` file with the latest font metadata from Google Fonts API. + +### Features + +- **Automatic Updates**: Runs daily via GitHub Actions to fetch the latest font data +- **PR Supersedence**: Automatically closes older update pull requests when a new update is available +- **Clean Repository**: Ensures only the most recent update PR remains open + +### How It Works + +1. **Scheduled Execution**: The script runs daily at midnight UTC via the `Update-FontsData` workflow +2. **Data Fetching**: Retrieves the latest font metadata from Google Fonts API +3. **Change Detection**: Compares new data with existing `FontsData.json` +4. **PR Creation**: If changes are detected: + - Creates a new branch named `auto-update-YYYYMMDD-HHmmss` + - Commits the updated `FontsData.json` + - Opens a pull request with title `Auto-Update YYYYMMDD-HHmmss` +5. **PR Supersedence**: Before creating a new PR, the script: + - Searches for existing open PRs with titles matching `Auto-Update*` + - Closes each superseded PR with a comment explaining the supersedence + - Ensures only the latest update PR remains open + +### PR Lifecycle Management + +The font data updater implements PR supersedence similar to Dependabot: + +#### When a New Update PR is Created + +- The script checks for existing open `Auto-Update*` PRs +- Each existing PR receives a comment: + ``` + This PR has been superseded by a newer update and will be closed automatically. + + The font data has been updated in a more recent PR. Please refer to the latest Auto-Update PR for the most current changes. + ``` +- All superseded PRs are automatically closed + +#### When an Update PR is Merged + +- The `Cleanup-FontsData-PRs` workflow is triggered +- Any remaining open `Auto-Update*` PRs are detected +- Each remaining PR receives a comment referencing the merged PR +- All obsolete PRs are automatically closed + +### Workflows + +#### Update-FontsData.yml + +Handles the scheduled updates and PR creation: +- **Trigger**: Daily at midnight UTC, or manual via `workflow_dispatch` +- **Authentication**: Uses GitHub App credentials for API access +- **Permissions**: Requires secrets: + - `GOOGLE_DEVELOPER_API_KEY`: For accessing Google Fonts API + - `GOOGLEFONTS_UPDATER_BOT_CLIENT_ID`: GitHub App client ID + - `GOOGLEFONTS_UPDATER_BOT_PRIVATE_KEY`: GitHub App private key + +#### Cleanup-FontsData-PRs.yml + +Handles cleanup after PR merges: +- **Trigger**: When a PR modifying `src/FontsData.json` is merged to main +- **Action**: Closes any remaining open `Auto-Update*` PRs that are now obsolete +- **Authentication**: Uses the same GitHub App credentials + +### Manual Execution + +You can manually trigger an update using the GitHub Actions UI: + +1. Go to the **Actions** tab in the repository +2. Select the **Update-FontsData** workflow +3. Click **Run workflow** +4. Select the branch and click **Run workflow** + +### Configuration + +The supersedence behavior is built into the script and requires no additional configuration. The message posted when closing superseded PRs is defined in the script and can be customized by modifying: + +- `scripts/Update-FontsData.ps1` (lines 135-138) - Message for PRs closed when creating a new update +- `.github/workflows/Cleanup-FontsData-PRs.yml` (lines 30-33) - Message for PRs closed after a merge + +### Development + +To test changes to the update script: + +1. Create a feature branch +2. Modify `scripts/Update-FontsData.ps1` +3. Push the branch +4. Manually trigger the workflow on your feature branch +5. The script will detect it's running on a feature branch and update the existing branch instead of creating a new PR + +### Troubleshooting + +- **No updates available**: If the Google Fonts API returns the same data, no PR will be created +- **Authentication errors**: Ensure the GitHub App credentials are correctly configured +- **API rate limits**: The Google Fonts API key must have sufficient quota for daily requests From 0a54d067afc6e5699907c064927e05d8bc487064 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 8 Feb 2026 11:05:11 +0000 Subject: [PATCH 04/16] Fix linting issues (trailing whitespace and YAML syntax) Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com> --- .github/workflows/Cleanup-FontsData-PRs.yml | 2 +- scripts/Update-FontsData.ps1 | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/Cleanup-FontsData-PRs.yml b/.github/workflows/Cleanup-FontsData-PRs.yml index c81b2eb..f4ed364 100644 --- a/.github/workflows/Cleanup-FontsData-PRs.yml +++ b/.github/workflows/Cleanup-FontsData-PRs.yml @@ -1,6 +1,6 @@ name: Cleanup-FontsData-PRs -on: +'on': pull_request: branches: - main diff --git a/scripts/Update-FontsData.ps1 b/scripts/Update-FontsData.ps1 index 6457938..ec9faa0 100644 --- a/scripts/Update-FontsData.ps1 +++ b/scripts/Update-FontsData.ps1 @@ -125,12 +125,12 @@ LogGroup 'Process changes' { Write-Output "Checking for existing open Auto-Update PRs..." $existingPRs = Get-GitHubPullRequest -Owner 'PSModule' -Name 'GoogleFonts' -State 'open' | Where-Object { $_.Title -like 'Auto-Update*' } - + if ($existingPRs) { Write-Output "Found $($existingPRs.Count) existing Auto-Update PR(s) to close." foreach ($pr in $existingPRs) { Write-Output "Closing PR #$($pr.Number): $($pr.Title)" - + # Add a comment explaining the supersedence $comment = @" This PR has been superseded by a newer update and will be closed automatically. @@ -138,17 +138,18 @@ This PR has been superseded by a newer update and will be closed automatically. The font data has been updated in a more recent PR. Please refer to the latest Auto-Update PR for the most current changes. "@ New-GitHubPullRequestComment -Owner 'PSModule' -Name 'GoogleFonts' -Number $pr.Number -Body $comment - + # Close the PR Set-GitHubPullRequest -Owner 'PSModule' -Name 'GoogleFonts' -Number $pr.Number -State 'closed' - + Write-Output "Successfully closed PR #$($pr.Number)" } } else { Write-Output "No existing open Auto-Update PRs found." } } - + + Run git push --set-upstream origin $targetBranch Run gh pr create ` From fbeff5900b6f3670cbf6f52963490cc24d934c23 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 8 Feb 2026 11:06:47 +0000 Subject: [PATCH 05/16] Address code review feedback: add PR references and fix YAML syntax Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com> --- .github/workflows/Cleanup-FontsData-PRs.yml | 19 +++++----- scripts/Update-FontsData.ps1 | 39 ++++++++++++--------- 2 files changed, 31 insertions(+), 27 deletions(-) diff --git a/.github/workflows/Cleanup-FontsData-PRs.yml b/.github/workflows/Cleanup-FontsData-PRs.yml index f4ed364..e9ae4f0 100644 --- a/.github/workflows/Cleanup-FontsData-PRs.yml +++ b/.github/workflows/Cleanup-FontsData-PRs.yml @@ -20,32 +20,31 @@ jobs: steps: - name: Cleanup Superseded PRs uses: PSModule/GitHub-Script@0097f3bbe3f413f3b577b9bcc600727b0ca3201a # v1.7.10 + env: + MERGED_PR_NUMBER: ${{ github.event.pull_request.number }} with: ClientID: ${{ secrets.GOOGLEFONTS_UPDATER_BOT_CLIENT_ID }} PrivateKey: ${{ secrets.GOOGLEFONTS_UPDATER_BOT_PRIVATE_KEY }} Script: | Connect-GitHubApp -Organization 'PSModule' -Default - + Write-Output "Checking for remaining open Auto-Update PRs after merge..." $existingPRs = Get-GitHubPullRequest -Owner 'PSModule' -Name 'GoogleFonts' -State 'open' | Where-Object { $_.Title -like 'Auto-Update*' } - + if ($existingPRs) { Write-Output "Found $($existingPRs.Count) existing Auto-Update PR(s) to close." foreach ($pr in $existingPRs) { Write-Output "Closing PR #$($pr.Number): $($pr.Title)" - + # Add a comment explaining the supersedence - $comment = @" - This PR has been superseded by PR #${{ github.event.pull_request.number }} which has been merged. - - The font data has been updated in the merged PR. This PR is now obsolete and will be closed automatically. - "@ + $mergedPRNumber = $env:MERGED_PR_NUMBER + $comment = "This PR has been superseded by PR #$mergedPRNumber which has been merged.`n`nThe font data has been updated in the merged PR. This PR is now obsolete and will be closed automatically." New-GitHubPullRequestComment -Owner 'PSModule' -Name 'GoogleFonts' -Number $pr.Number -Body $comment - + # Close the PR Set-GitHubPullRequest -Owner 'PSModule' -Name 'GoogleFonts' -Number $pr.Number -State 'closed' - + Write-Output "Successfully closed PR #$($pr.Number)" } } else { diff --git a/scripts/Update-FontsData.ps1 b/scripts/Update-FontsData.ps1 index ec9faa0..69908fb 100644 --- a/scripts/Update-FontsData.ps1 +++ b/scripts/Update-FontsData.ps1 @@ -120,11 +120,27 @@ LogGroup 'Process changes' { Run git push origin $targetBranch Write-Output "Changes committed and pushed to existing branch: $targetBranch" } else { - # Close any existing open Auto-Update PRs before creating a new one + Run git push --set-upstream origin $targetBranch + + Run gh pr create ` + --base $defaultBranch ` + --head $targetBranch ` + --title "Auto-Update $timeStamp" ` + --body 'This PR updates FontsData.json with the latest metadata.' + + Write-Output "Changes detected and PR opened for branch: $targetBranch" + + # Close any existing open Auto-Update PRs after creating the new one LogGroup 'Close superseded PRs' { - Write-Output "Checking for existing open Auto-Update PRs..." + Write-Output "Checking for existing open Auto-Update PRs to supersede..." + + # Get the newly created PR + $newPR = Get-GitHubPullRequest -Owner 'PSModule' -Name 'GoogleFonts' -Head "PSModule:$targetBranch" -State 'open' | + Select-Object -First 1 + + # Find existing PRs (excluding the one we just created) $existingPRs = Get-GitHubPullRequest -Owner 'PSModule' -Name 'GoogleFonts' -State 'open' | - Where-Object { $_.Title -like 'Auto-Update*' } + Where-Object { $_.Title -like 'Auto-Update*' -and $_.Number -ne $newPR.Number } if ($existingPRs) { Write-Output "Found $($existingPRs.Count) existing Auto-Update PR(s) to close." @@ -133,9 +149,9 @@ LogGroup 'Process changes' { # Add a comment explaining the supersedence $comment = @" -This PR has been superseded by a newer update and will be closed automatically. +This PR has been superseded by #$($newPR.Number) and will be closed automatically. -The font data has been updated in a more recent PR. Please refer to the latest Auto-Update PR for the most current changes. +The font data has been updated in the newer PR. Please refer to #$($newPR.Number) for the most current changes. "@ New-GitHubPullRequestComment -Owner 'PSModule' -Name 'GoogleFonts' -Number $pr.Number -Body $comment @@ -145,19 +161,8 @@ The font data has been updated in a more recent PR. Please refer to the latest A Write-Output "Successfully closed PR #$($pr.Number)" } } else { - Write-Output "No existing open Auto-Update PRs found." + Write-Output "No existing open Auto-Update PRs to close." } } - - - Run git push --set-upstream origin $targetBranch - - Run gh pr create ` - --base $defaultBranch ` - --head $targetBranch ` - --title "Auto-Update $timeStamp" ` - --body 'This PR updates FontsData.json with the latest metadata.' - - Write-Output "Changes detected and PR opened for branch: $targetBranch" } } From 2fd15cb20ba7f17765b637affe95c632b375a2c5 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 8 Feb 2026 11:07:34 +0000 Subject: [PATCH 06/16] Fix documentation to match implementation Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com> --- scripts/README.md | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/scripts/README.md b/scripts/README.md index 5d05c3b..1bee332 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -21,9 +21,9 @@ This script automatically updates the `src/FontsData.json` file with the latest - Creates a new branch named `auto-update-YYYYMMDD-HHmmss` - Commits the updated `FontsData.json` - Opens a pull request with title `Auto-Update YYYYMMDD-HHmmss` -5. **PR Supersedence**: Before creating a new PR, the script: - - Searches for existing open PRs with titles matching `Auto-Update*` - - Closes each superseded PR with a comment explaining the supersedence +5. **PR Supersedence**: After creating a new PR, the script: + - Searches for existing open PRs with titles matching `Auto-Update*` (excluding the newly created PR) + - Closes each superseded PR with a comment referencing the new PR number - Ensures only the latest update PR remains open ### PR Lifecycle Management @@ -32,12 +32,13 @@ The font data updater implements PR supersedence similar to Dependabot: #### When a New Update PR is Created -- The script checks for existing open `Auto-Update*` PRs -- Each existing PR receives a comment: +- The script first creates the new PR +- Then checks for existing open `Auto-Update*` PRs (excluding the newly created one) +- Each existing PR receives a comment referencing the new PR number: ``` - This PR has been superseded by a newer update and will be closed automatically. - - The font data has been updated in a more recent PR. Please refer to the latest Auto-Update PR for the most current changes. + This PR has been superseded by #[NEW_PR_NUMBER] and will be closed automatically. + + The font data has been updated in the newer PR. Please refer to #[NEW_PR_NUMBER] for the most current changes. ``` - All superseded PRs are automatically closed @@ -80,8 +81,8 @@ You can manually trigger an update using the GitHub Actions UI: The supersedence behavior is built into the script and requires no additional configuration. The message posted when closing superseded PRs is defined in the script and can be customized by modifying: -- `scripts/Update-FontsData.ps1` (lines 135-138) - Message for PRs closed when creating a new update -- `.github/workflows/Cleanup-FontsData-PRs.yml` (lines 30-33) - Message for PRs closed after a merge +- `scripts/Update-FontsData.ps1` (lines 151-154) - Message for PRs closed when creating a new update +- `.github/workflows/Cleanup-FontsData-PRs.yml` (line 42) - Message for PRs closed after a merge ### Development From 5397886e1db03a8bad37c7c471aa15f4b60d37c2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 8 Feb 2026 11:09:40 +0000 Subject: [PATCH 07/16] Add retry logic for PR retrieval and improve comment formatting Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com> --- .github/workflows/Cleanup-FontsData-PRs.yml | 7 ++++++- scripts/Update-FontsData.ps1 | 23 ++++++++++++++++++--- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/.github/workflows/Cleanup-FontsData-PRs.yml b/.github/workflows/Cleanup-FontsData-PRs.yml index e9ae4f0..540e386 100644 --- a/.github/workflows/Cleanup-FontsData-PRs.yml +++ b/.github/workflows/Cleanup-FontsData-PRs.yml @@ -39,7 +39,12 @@ jobs: # Add a comment explaining the supersedence $mergedPRNumber = $env:MERGED_PR_NUMBER - $comment = "This PR has been superseded by PR #$mergedPRNumber which has been merged.`n`nThe font data has been updated in the merged PR. This PR is now obsolete and will be closed automatically." + $commentLines = @( + "This PR has been superseded by PR #$mergedPRNumber which has been merged." + "" + "The font data has been updated in the merged PR. This PR is now obsolete and will be closed automatically." + ) + $comment = $commentLines -join "`n" New-GitHubPullRequestComment -Owner 'PSModule' -Name 'GoogleFonts' -Number $pr.Number -Body $comment # Close the PR diff --git a/scripts/Update-FontsData.ps1 b/scripts/Update-FontsData.ps1 index 69908fb..e5634eb 100644 --- a/scripts/Update-FontsData.ps1 +++ b/scripts/Update-FontsData.ps1 @@ -134,9 +134,26 @@ LogGroup 'Process changes' { LogGroup 'Close superseded PRs' { Write-Output "Checking for existing open Auto-Update PRs to supersede..." - # Get the newly created PR - $newPR = Get-GitHubPullRequest -Owner 'PSModule' -Name 'GoogleFonts' -Head "PSModule:$targetBranch" -State 'open' | - Select-Object -First 1 + # Get the newly created PR with retry logic + $newPR = $null + $retryCount = 0 + $maxRetries = 3 + while ($null -eq $newPR -and $retryCount -lt $maxRetries) { + Start-Sleep -Seconds 2 + $newPR = Get-GitHubPullRequest -Owner 'PSModule' -Name 'GoogleFonts' -Head "PSModule:$targetBranch" -State 'open' | + Select-Object -First 1 + $retryCount++ + if ($null -eq $newPR -and $retryCount -lt $maxRetries) { + Write-Output "PR not found yet, retrying... ($retryCount/$maxRetries)" + } + } + + if ($null -eq $newPR) { + Write-Warning "Could not retrieve the newly created PR. Skipping supersedence logic." + return + } + + Write-Output "Found new PR #$($newPR.Number): $($newPR.Title)" # Find existing PRs (excluding the one we just created) $existingPRs = Get-GitHubPullRequest -Owner 'PSModule' -Name 'GoogleFonts' -State 'open' | From 86fa0a2365ef54b8cae80606b75550e36acc8587 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 8 Feb 2026 11:10:53 +0000 Subject: [PATCH 08/16] Fix control flow and update documentation line references Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com> --- scripts/README.md | 4 ++-- scripts/Update-FontsData.ps1 | 39 ++++++++++++++++++------------------ 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/scripts/README.md b/scripts/README.md index 1bee332..2fa7f21 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -81,8 +81,8 @@ You can manually trigger an update using the GitHub Actions UI: The supersedence behavior is built into the script and requires no additional configuration. The message posted when closing superseded PRs is defined in the script and can be customized by modifying: -- `scripts/Update-FontsData.ps1` (lines 151-154) - Message for PRs closed when creating a new update -- `.github/workflows/Cleanup-FontsData-PRs.yml` (line 42) - Message for PRs closed after a merge +- `scripts/Update-FontsData.ps1` (lines 164-168) - Message for PRs closed when creating a new update +- `.github/workflows/Cleanup-FontsData-PRs.yml` (lines 41-45) - Message for PRs closed after a merge ### Development diff --git a/scripts/Update-FontsData.ps1 b/scripts/Update-FontsData.ps1 index e5634eb..80d5d34 100644 --- a/scripts/Update-FontsData.ps1 +++ b/scripts/Update-FontsData.ps1 @@ -148,37 +148,36 @@ LogGroup 'Process changes' { } } - if ($null -eq $newPR) { - Write-Warning "Could not retrieve the newly created PR. Skipping supersedence logic." - return - } - - Write-Output "Found new PR #$($newPR.Number): $($newPR.Title)" + if ($null -ne $newPR) { + Write-Output "Found new PR #$($newPR.Number): $($newPR.Title)" - # Find existing PRs (excluding the one we just created) - $existingPRs = Get-GitHubPullRequest -Owner 'PSModule' -Name 'GoogleFonts' -State 'open' | - Where-Object { $_.Title -like 'Auto-Update*' -and $_.Number -ne $newPR.Number } + # Find existing PRs (excluding the one we just created) + $existingPRs = Get-GitHubPullRequest -Owner 'PSModule' -Name 'GoogleFonts' -State 'open' | + Where-Object { $_.Title -like 'Auto-Update*' -and $_.Number -ne $newPR.Number } - if ($existingPRs) { - Write-Output "Found $($existingPRs.Count) existing Auto-Update PR(s) to close." - foreach ($pr in $existingPRs) { - Write-Output "Closing PR #$($pr.Number): $($pr.Title)" + if ($existingPRs) { + Write-Output "Found $($existingPRs.Count) existing Auto-Update PR(s) to close." + foreach ($pr in $existingPRs) { + Write-Output "Closing PR #$($pr.Number): $($pr.Title)" - # Add a comment explaining the supersedence - $comment = @" + # Add a comment explaining the supersedence + $comment = @" This PR has been superseded by #$($newPR.Number) and will be closed automatically. The font data has been updated in the newer PR. Please refer to #$($newPR.Number) for the most current changes. "@ - New-GitHubPullRequestComment -Owner 'PSModule' -Name 'GoogleFonts' -Number $pr.Number -Body $comment + New-GitHubPullRequestComment -Owner 'PSModule' -Name 'GoogleFonts' -Number $pr.Number -Body $comment - # Close the PR - Set-GitHubPullRequest -Owner 'PSModule' -Name 'GoogleFonts' -Number $pr.Number -State 'closed' + # Close the PR + Set-GitHubPullRequest -Owner 'PSModule' -Name 'GoogleFonts' -Number $pr.Number -State 'closed' - Write-Output "Successfully closed PR #$($pr.Number)" + Write-Output "Successfully closed PR #$($pr.Number)" + } + } else { + Write-Output "No existing open Auto-Update PRs to close." } } else { - Write-Output "No existing open Auto-Update PRs to close." + Write-Warning "Could not retrieve the newly created PR after $maxRetries attempts. Skipping supersedence logic." } } } From 47774222b05d0f6097d7447b19649ba73d4aa1fe Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 8 Feb 2026 11:11:54 +0000 Subject: [PATCH 09/16] Improve retry logic with progressive delays Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com> --- scripts/Update-FontsData.ps1 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/Update-FontsData.ps1 b/scripts/Update-FontsData.ps1 index 80d5d34..df1ee98 100644 --- a/scripts/Update-FontsData.ps1 +++ b/scripts/Update-FontsData.ps1 @@ -138,13 +138,16 @@ LogGroup 'Process changes' { $newPR = $null $retryCount = 0 $maxRetries = 3 + $retryDelays = @(1, 2, 3) # Progressive delays in seconds while ($null -eq $newPR -and $retryCount -lt $maxRetries) { - Start-Sleep -Seconds 2 + if ($retryCount -gt 0) { + Start-Sleep -Seconds $retryDelays[$retryCount - 1] + } $newPR = Get-GitHubPullRequest -Owner 'PSModule' -Name 'GoogleFonts' -Head "PSModule:$targetBranch" -State 'open' | Select-Object -First 1 $retryCount++ if ($null -eq $newPR -and $retryCount -lt $maxRetries) { - Write-Output "PR not found yet, retrying... ($retryCount/$maxRetries)" + Write-Output "PR not found yet, retrying in $($retryDelays[$retryCount - 1]) seconds... (attempt $retryCount/$maxRetries)" } } From a4857abb4686d86c68fa0111c49b03f3010dae5f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 9 Feb 2026 08:08:03 +0000 Subject: [PATCH 10/16] Refactor: Move workflow script to separate file and fix on: syntax Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com> --- .github/workflows/Cleanup-FontsData-PRs.yml | 39 +++++---------------- scripts/Close-SupersededPRs.ps1 | 29 +++++++++++++++ scripts/README.md | 21 +++++++++-- 3 files changed, 56 insertions(+), 33 deletions(-) create mode 100644 scripts/Close-SupersededPRs.ps1 diff --git a/.github/workflows/Cleanup-FontsData-PRs.yml b/.github/workflows/Cleanup-FontsData-PRs.yml index 540e386..3bc3c27 100644 --- a/.github/workflows/Cleanup-FontsData-PRs.yml +++ b/.github/workflows/Cleanup-FontsData-PRs.yml @@ -1,6 +1,6 @@ name: Cleanup-FontsData-PRs -'on': +on: pull_request: branches: - main @@ -18,6 +18,12 @@ jobs: # Only run if the PR was merged (not just closed) if: github.event.pull_request.merged == true steps: + - name: Checkout repository + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + fetch-depth: 0 + persist-credentials: false + - name: Cleanup Superseded PRs uses: PSModule/GitHub-Script@0097f3bbe3f413f3b577b9bcc600727b0ca3201a # v1.7.10 env: @@ -25,33 +31,4 @@ jobs: with: ClientID: ${{ secrets.GOOGLEFONTS_UPDATER_BOT_CLIENT_ID }} PrivateKey: ${{ secrets.GOOGLEFONTS_UPDATER_BOT_PRIVATE_KEY }} - Script: | - Connect-GitHubApp -Organization 'PSModule' -Default - - Write-Output "Checking for remaining open Auto-Update PRs after merge..." - $existingPRs = Get-GitHubPullRequest -Owner 'PSModule' -Name 'GoogleFonts' -State 'open' | - Where-Object { $_.Title -like 'Auto-Update*' } - - if ($existingPRs) { - Write-Output "Found $($existingPRs.Count) existing Auto-Update PR(s) to close." - foreach ($pr in $existingPRs) { - Write-Output "Closing PR #$($pr.Number): $($pr.Title)" - - # Add a comment explaining the supersedence - $mergedPRNumber = $env:MERGED_PR_NUMBER - $commentLines = @( - "This PR has been superseded by PR #$mergedPRNumber which has been merged." - "" - "The font data has been updated in the merged PR. This PR is now obsolete and will be closed automatically." - ) - $comment = $commentLines -join "`n" - New-GitHubPullRequestComment -Owner 'PSModule' -Name 'GoogleFonts' -Number $pr.Number -Body $comment - - # Close the PR - Set-GitHubPullRequest -Owner 'PSModule' -Name 'GoogleFonts' -Number $pr.Number -State 'closed' - - Write-Output "Successfully closed PR #$($pr.Number)" - } - } else { - Write-Output "No remaining open Auto-Update PRs to close." - } + Script: scripts/Close-SupersededPRs.ps1 diff --git a/scripts/Close-SupersededPRs.ps1 b/scripts/Close-SupersededPRs.ps1 new file mode 100644 index 0000000..42775aa --- /dev/null +++ b/scripts/Close-SupersededPRs.ps1 @@ -0,0 +1,29 @@ +Connect-GitHubApp -Organization 'PSModule' -Default + +Write-Output "Checking for remaining open Auto-Update PRs after merge..." +$existingPRs = Get-GitHubPullRequest -Owner 'PSModule' -Name 'GoogleFonts' -State 'open' | + Where-Object { $_.Title -like 'Auto-Update*' } + +if ($existingPRs) { + Write-Output "Found $($existingPRs.Count) existing Auto-Update PR(s) to close." + foreach ($pr in $existingPRs) { + Write-Output "Closing PR #$($pr.Number): $($pr.Title)" + + # Add a comment explaining the supersedence + $mergedPRNumber = $env:MERGED_PR_NUMBER + $commentLines = @( + "This PR has been superseded by PR #$mergedPRNumber which has been merged." + "" + "The font data has been updated in the merged PR. This PR is now obsolete and will be closed automatically." + ) + $comment = $commentLines -join "`n" + New-GitHubPullRequestComment -Owner 'PSModule' -Name 'GoogleFonts' -Number $pr.Number -Body $comment + + # Close the PR + Set-GitHubPullRequest -Owner 'PSModule' -Name 'GoogleFonts' -Number $pr.Number -State 'closed' + + Write-Output "Successfully closed PR #$($pr.Number)" + } +} else { + Write-Output "No remaining open Auto-Update PRs to close." +} diff --git a/scripts/README.md b/scripts/README.md index 2fa7f21..1c0a4dd 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -65,9 +65,26 @@ Handles the scheduled updates and PR creation: Handles cleanup after PR merges: - **Trigger**: When a PR modifying `src/FontsData.json` is merged to main +- **Script**: Calls `scripts/Close-SupersededPRs.ps1` to close remaining open `Auto-Update*` PRs - **Action**: Closes any remaining open `Auto-Update*` PRs that are now obsolete - **Authentication**: Uses the same GitHub App credentials +### Scripts + +#### Update-FontsData.ps1 + +Main script for updating font data: +- Fetches latest font metadata from Google Fonts API +- Creates update PR if changes are detected +- Closes superseded PRs after creating the new PR + +#### Close-SupersededPRs.ps1 + +Cleanup script called by the Cleanup-FontsData-PRs workflow: +- Finds remaining open `Auto-Update*` PRs +- Closes them with a comment referencing the merged PR +- Uses environment variable `MERGED_PR_NUMBER` for the PR reference + ### Manual Execution You can manually trigger an update using the GitHub Actions UI: @@ -79,10 +96,10 @@ You can manually trigger an update using the GitHub Actions UI: ### Configuration -The supersedence behavior is built into the script and requires no additional configuration. The message posted when closing superseded PRs is defined in the script and can be customized by modifying: +The supersedence behavior is built into the scripts and requires no additional configuration. The message posted when closing superseded PRs is defined in the scripts and can be customized by modifying: - `scripts/Update-FontsData.ps1` (lines 164-168) - Message for PRs closed when creating a new update -- `.github/workflows/Cleanup-FontsData-PRs.yml` (lines 41-45) - Message for PRs closed after a merge +- `scripts/Close-SupersededPRs.ps1` (lines 13-17) - Message for PRs closed after a merge ### Development From ff274e996546313e34871b53b10931394d4c2874 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Mon, 9 Feb 2026 09:13:37 +0100 Subject: [PATCH 11/16] Remove redundant Cleanup-FontsData-PRs workflow and script The Update-FontsData.ps1 script already closes superseded Auto-Update PRs immediately after creating a new one, making the separate cleanup workflow (triggered on PR merge) redundant. --- .github/workflows/Cleanup-FontsData-PRs.yml | 34 --------------------- scripts/Close-SupersededPRs.ps1 | 29 ------------------ 2 files changed, 63 deletions(-) delete mode 100644 .github/workflows/Cleanup-FontsData-PRs.yml delete mode 100644 scripts/Close-SupersededPRs.ps1 diff --git a/.github/workflows/Cleanup-FontsData-PRs.yml b/.github/workflows/Cleanup-FontsData-PRs.yml deleted file mode 100644 index 3bc3c27..0000000 --- a/.github/workflows/Cleanup-FontsData-PRs.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Cleanup-FontsData-PRs - -on: - pull_request: - branches: - - main - types: - - closed - paths: - - 'src/FontsData.json' - -permissions: {} - -jobs: - Cleanup-Superseded-PRs: - name: Cleanup Superseded Font Data PRs - runs-on: ubuntu-latest - # Only run if the PR was merged (not just closed) - if: github.event.pull_request.merged == true - steps: - - name: Checkout repository - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - with: - fetch-depth: 0 - persist-credentials: false - - - name: Cleanup Superseded PRs - uses: PSModule/GitHub-Script@0097f3bbe3f413f3b577b9bcc600727b0ca3201a # v1.7.10 - env: - MERGED_PR_NUMBER: ${{ github.event.pull_request.number }} - with: - ClientID: ${{ secrets.GOOGLEFONTS_UPDATER_BOT_CLIENT_ID }} - PrivateKey: ${{ secrets.GOOGLEFONTS_UPDATER_BOT_PRIVATE_KEY }} - Script: scripts/Close-SupersededPRs.ps1 diff --git a/scripts/Close-SupersededPRs.ps1 b/scripts/Close-SupersededPRs.ps1 deleted file mode 100644 index 42775aa..0000000 --- a/scripts/Close-SupersededPRs.ps1 +++ /dev/null @@ -1,29 +0,0 @@ -Connect-GitHubApp -Organization 'PSModule' -Default - -Write-Output "Checking for remaining open Auto-Update PRs after merge..." -$existingPRs = Get-GitHubPullRequest -Owner 'PSModule' -Name 'GoogleFonts' -State 'open' | - Where-Object { $_.Title -like 'Auto-Update*' } - -if ($existingPRs) { - Write-Output "Found $($existingPRs.Count) existing Auto-Update PR(s) to close." - foreach ($pr in $existingPRs) { - Write-Output "Closing PR #$($pr.Number): $($pr.Title)" - - # Add a comment explaining the supersedence - $mergedPRNumber = $env:MERGED_PR_NUMBER - $commentLines = @( - "This PR has been superseded by PR #$mergedPRNumber which has been merged." - "" - "The font data has been updated in the merged PR. This PR is now obsolete and will be closed automatically." - ) - $comment = $commentLines -join "`n" - New-GitHubPullRequestComment -Owner 'PSModule' -Name 'GoogleFonts' -Number $pr.Number -Body $comment - - # Close the PR - Set-GitHubPullRequest -Owner 'PSModule' -Name 'GoogleFonts' -Number $pr.Number -State 'closed' - - Write-Output "Successfully closed PR #$($pr.Number)" - } -} else { - Write-Output "No remaining open Auto-Update PRs to close." -} From 6fc574ac5a20c2d5c8ed246a93c4180786e18803 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Mon, 9 Feb 2026 09:15:21 +0100 Subject: [PATCH 12/16] Update scripts README to remove references to deleted cleanup workflow --- scripts/README.md | 46 ++++++---------------------------------------- 1 file changed, 6 insertions(+), 40 deletions(-) diff --git a/scripts/README.md b/scripts/README.md index 1c0a4dd..f7cfa44 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -9,7 +9,7 @@ This script automatically updates the `src/FontsData.json` file with the latest ### Features - **Automatic Updates**: Runs daily via GitHub Actions to fetch the latest font data -- **PR Supersedence**: Automatically closes older update pull requests when a new update is available +- **PR Supersedence**: Automatically closes older update pull requests when a new update is created - **Clean Repository**: Ensures only the most recent update PR remains open ### How It Works @@ -28,9 +28,7 @@ This script automatically updates the `src/FontsData.json` file with the latest ### PR Lifecycle Management -The font data updater implements PR supersedence similar to Dependabot: - -#### When a New Update PR is Created +The font data updater implements PR supersedence similar to Dependabot. When a new update PR is created: - The script first creates the new PR - Then checks for existing open `Auto-Update*` PRs (excluding the newly created one) @@ -42,18 +40,13 @@ The font data updater implements PR supersedence similar to Dependabot: ``` - All superseded PRs are automatically closed -#### When an Update PR is Merged - -- The `Cleanup-FontsData-PRs` workflow is triggered -- Any remaining open `Auto-Update*` PRs are detected -- Each remaining PR receives a comment referencing the merged PR -- All obsolete PRs are automatically closed +This means there is no need for a separate cleanup workflow on merge — by the time a PR is merged, it is already the only open Auto-Update PR. -### Workflows +### Workflow #### Update-FontsData.yml -Handles the scheduled updates and PR creation: +Handles the scheduled updates, PR creation, and supersedence: - **Trigger**: Daily at midnight UTC, or manual via `workflow_dispatch` - **Authentication**: Uses GitHub App credentials for API access - **Permissions**: Requires secrets: @@ -61,30 +54,6 @@ Handles the scheduled updates and PR creation: - `GOOGLEFONTS_UPDATER_BOT_CLIENT_ID`: GitHub App client ID - `GOOGLEFONTS_UPDATER_BOT_PRIVATE_KEY`: GitHub App private key -#### Cleanup-FontsData-PRs.yml - -Handles cleanup after PR merges: -- **Trigger**: When a PR modifying `src/FontsData.json` is merged to main -- **Script**: Calls `scripts/Close-SupersededPRs.ps1` to close remaining open `Auto-Update*` PRs -- **Action**: Closes any remaining open `Auto-Update*` PRs that are now obsolete -- **Authentication**: Uses the same GitHub App credentials - -### Scripts - -#### Update-FontsData.ps1 - -Main script for updating font data: -- Fetches latest font metadata from Google Fonts API -- Creates update PR if changes are detected -- Closes superseded PRs after creating the new PR - -#### Close-SupersededPRs.ps1 - -Cleanup script called by the Cleanup-FontsData-PRs workflow: -- Finds remaining open `Auto-Update*` PRs -- Closes them with a comment referencing the merged PR -- Uses environment variable `MERGED_PR_NUMBER` for the PR reference - ### Manual Execution You can manually trigger an update using the GitHub Actions UI: @@ -96,10 +65,7 @@ You can manually trigger an update using the GitHub Actions UI: ### Configuration -The supersedence behavior is built into the scripts and requires no additional configuration. The message posted when closing superseded PRs is defined in the scripts and can be customized by modifying: - -- `scripts/Update-FontsData.ps1` (lines 164-168) - Message for PRs closed when creating a new update -- `scripts/Close-SupersededPRs.ps1` (lines 13-17) - Message for PRs closed after a merge +The supersedence behavior is built into the script and requires no additional configuration. The message posted when closing superseded PRs can be customized by modifying `scripts/Update-FontsData.ps1` (lines 164-168). ### Development From f2a2f89ddde6da375df6f43bd8da157d51949199 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Mon, 9 Feb 2026 10:42:47 +0100 Subject: [PATCH 13/16] Refactor: Update PR handling logic to use GitHub CLI and improve output formatting --- scripts/Update-FontsData.ps1 | 38 ++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/scripts/Update-FontsData.ps1 b/scripts/Update-FontsData.ps1 index df1ee98..4cc1bcf 100644 --- a/scripts/Update-FontsData.ps1 +++ b/scripts/Update-FontsData.ps1 @@ -132,19 +132,23 @@ LogGroup 'Process changes' { # Close any existing open Auto-Update PRs after creating the new one LogGroup 'Close superseded PRs' { - Write-Output "Checking for existing open Auto-Update PRs to supersede..." + Write-Output 'Checking for existing open Auto-Update PRs to supersede...' # Get the newly created PR with retry logic - $newPR = $null + $newPRJson = $null $retryCount = 0 $maxRetries = 3 $retryDelays = @(1, 2, 3) # Progressive delays in seconds - while ($null -eq $newPR -and $retryCount -lt $maxRetries) { + while ($null -eq $newPRJson -and $retryCount -lt $maxRetries) { if ($retryCount -gt 0) { Start-Sleep -Seconds $retryDelays[$retryCount - 1] } - $newPR = Get-GitHubPullRequest -Owner 'PSModule' -Name 'GoogleFonts' -Head "PSModule:$targetBranch" -State 'open' | - Select-Object -First 1 + $newPRJson = Run gh pr list --repo 'PSModule/GoogleFonts' --head $targetBranch --state open --json number, title --limit 1 + $newPR = $newPRJson | ConvertFrom-Json | Select-Object -First 1 + if ($null -eq $newPR -or $null -eq $newPR.number) { + $newPR = $null + $newPRJson = $null + } $retryCount++ if ($null -eq $newPR -and $retryCount -lt $maxRetries) { Write-Output "PR not found yet, retrying in $($retryDelays[$retryCount - 1]) seconds... (attempt $retryCount/$maxRetries)" @@ -152,32 +156,32 @@ LogGroup 'Process changes' { } if ($null -ne $newPR) { - Write-Output "Found new PR #$($newPR.Number): $($newPR.Title)" + Write-Output "Found new PR #$($newPR.number): $($newPR.title)" - # Find existing PRs (excluding the one we just created) - $existingPRs = Get-GitHubPullRequest -Owner 'PSModule' -Name 'GoogleFonts' -State 'open' | - Where-Object { $_.Title -like 'Auto-Update*' -and $_.Number -ne $newPR.Number } + # Find existing open Auto-Update PRs (excluding the one we just created) + $existingPRsJson = Run gh pr list --repo 'PSModule/GoogleFonts' --state open --search 'Auto-Update in:title' --json number, title + $existingPRs = $existingPRsJson | ConvertFrom-Json | Where-Object { $_.number -ne $newPR.number } if ($existingPRs) { - Write-Output "Found $($existingPRs.Count) existing Auto-Update PR(s) to close." + Write-Output "Found $(@($existingPRs).Count) existing Auto-Update PR(s) to close." foreach ($pr in $existingPRs) { - Write-Output "Closing PR #$($pr.Number): $($pr.Title)" + Write-Output "Closing PR #$($pr.number): $($pr.title)" # Add a comment explaining the supersedence $comment = @" -This PR has been superseded by #$($newPR.Number) and will be closed automatically. +This PR has been superseded by #$($newPR.number) and will be closed automatically. -The font data has been updated in the newer PR. Please refer to #$($newPR.Number) for the most current changes. +The font data has been updated in the newer PR. Please refer to #$($newPR.number) for the most current changes. "@ - New-GitHubPullRequestComment -Owner 'PSModule' -Name 'GoogleFonts' -Number $pr.Number -Body $comment + gh pr comment $pr.number --repo 'PSModule/GoogleFonts' --body $comment # Close the PR - Set-GitHubPullRequest -Owner 'PSModule' -Name 'GoogleFonts' -Number $pr.Number -State 'closed' + gh pr close $pr.number --repo 'PSModule/GoogleFonts' - Write-Output "Successfully closed PR #$($pr.Number)" + Write-Output "Successfully closed PR #$($pr.number)" } } else { - Write-Output "No existing open Auto-Update PRs to close." + Write-Output 'No existing open Auto-Update PRs to close.' } } else { Write-Warning "Could not retrieve the newly created PR after $maxRetries attempts. Skipping supersedence logic." From 0d74a481f2edc6e20a394fba940f1e9bc7a21c16 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Tue, 10 Feb 2026 09:12:07 +0100 Subject: [PATCH 14/16] Fix: Use Run command for GitHub CLI PR comments and closure --- scripts/Update-FontsData.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/Update-FontsData.ps1 b/scripts/Update-FontsData.ps1 index 4cc1bcf..784761c 100644 --- a/scripts/Update-FontsData.ps1 +++ b/scripts/Update-FontsData.ps1 @@ -173,10 +173,10 @@ This PR has been superseded by #$($newPR.number) and will be closed automaticall The font data has been updated in the newer PR. Please refer to #$($newPR.number) for the most current changes. "@ - gh pr comment $pr.number --repo 'PSModule/GoogleFonts' --body $comment + Run gh pr comment $pr.number --repo 'PSModule/GoogleFonts' --body $comment # Close the PR - gh pr close $pr.number --repo 'PSModule/GoogleFonts' + Run h pr close $pr.number --repo 'PSModule/GoogleFonts' Write-Output "Successfully closed PR #$($pr.number)" } From c257960b2cbcb522882b28ca0b2419cc3e0801a0 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Tue, 10 Feb 2026 09:34:30 +0100 Subject: [PATCH 15/16] Fix: Update comment formatting in README for PR supersedence notifications --- scripts/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/README.md b/scripts/README.md index f7cfa44..ec26d38 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -33,7 +33,7 @@ The font data updater implements PR supersedence similar to Dependabot. When a n - The script first creates the new PR - Then checks for existing open `Auto-Update*` PRs (excluding the newly created one) - Each existing PR receives a comment referencing the new PR number: - ``` + ```text This PR has been superseded by #[NEW_PR_NUMBER] and will be closed automatically. The font data has been updated in the newer PR. Please refer to #[NEW_PR_NUMBER] for the most current changes. From f5e7d0c335860bd232529c06af612a7359156f31 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Tue, 10 Feb 2026 10:55:54 +0100 Subject: [PATCH 16/16] Fix: Update README to clarify customization of PR supersedence closure messages --- scripts/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/README.md b/scripts/README.md index ec26d38..1d8ab7a 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -65,7 +65,8 @@ You can manually trigger an update using the GitHub Actions UI: ### Configuration -The supersedence behavior is built into the script and requires no additional configuration. The message posted when closing superseded PRs can be customized by modifying `scripts/Update-FontsData.ps1` (lines 164-168). +The supersedence behavior is built into the script and requires no additional configuration. The message posted when closing superseded PRs can be +customized by modifying `scripts/Update-FontsData.ps1`. ### Development