Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ This directory contains scripts for automating the maintenance of the GoogleFont

## Update-FontsData.ps1

This script automatically updates the `src/FontsData.json` file with the latest font metadata from Google Fonts API.
This script automatically updates the `src/FontsData.json` file with the latest font metadata from
Google Fonts API.

### Features

Expand All @@ -24,6 +25,7 @@ This script automatically updates the `src/FontsData.json` file with the latest
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
- Deletes the branches associated with superseded PRs
Comment on lines 25 to +28
Copy link

Copilot AI Feb 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Documentation says the script searches for PR titles matching Auto-Update*, but Update-FontsData.ps1 actually uses gh pr list --search 'Auto-Update in:title', which matches any title containing Auto-Update (not necessarily a prefix/wildcard pattern). Consider rewording to "titles containing 'Auto-Update'" to reflect the actual search behavior.

Copilot uses AI. Check for mistakes.
- Ensures only the latest update PR remains open

### PR Lifecycle Management
Expand All @@ -33,20 +35,25 @@ 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:
Comment on lines 35 to 37
Copy link

Copilot AI Feb 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above: this section describes checking for existing open Auto-Update* PRs, but the script’s query is Auto-Update in:title (contains match). Rewording this to a contains match would keep the README aligned with the implementation.

Copilot uses AI. Check for mistakes.

```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.
```

- All superseded PRs are automatically closed
- Branches for closed PRs are deleted
Copy link

Copilot AI Feb 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Branches for closed PRs are deleted" is a bit broader than what the script does: it deletes branches for PRs it closes as part of supersedence (existing open Auto-Update PRs). Suggest rephrasing to "Branches for superseded PRs are deleted" (optionally noting deletion is best-effort).

Suggested change
- Branches for closed PRs are deleted
- Branches for superseded PRs are deleted (best-effort)

Copilot uses AI. Check for mistakes.

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.
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.

### Workflow

#### Update-FontsData.yml

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:
Expand All @@ -65,8 +72,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`.
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

Expand All @@ -76,7 +83,8 @@ To test changes to the update script:
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
5. The script will detect it's running on a feature branch and update the existing branch instead of
creating a new PR

### Troubleshooting

Expand Down
Loading