generated from PSModule/Template-PSModule
-
Notifications
You must be signed in to change notification settings - Fork 0
⚙️ [Maintenance]: Implement PR Supersedence for Font Data Updater #147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
MariusStorhaug
merged 17 commits into
main
from
copilot/implement-font-data-pr-supersedence
Feb 10, 2026
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
af8da23
Initial plan
Copilot d6ff407
Implement PR supersedence for font data updater
Copilot 223424f
Add documentation for font data updater and PR supersedence
Copilot 0a54d06
Fix linting issues (trailing whitespace and YAML syntax)
Copilot fbeff59
Address code review feedback: add PR references and fix YAML syntax
Copilot 2fd15cb
Fix documentation to match implementation
Copilot 5397886
Add retry logic for PR retrieval and improve comment formatting
Copilot 86fa0a2
Fix control flow and update documentation line references
Copilot 4777422
Improve retry logic with progressive delays
Copilot a4857ab
Refactor: Move workflow script to separate file and fix on: syntax
Copilot ff274e9
Remove redundant Cleanup-FontsData-PRs workflow and script
MariusStorhaug 6fc574a
Update scripts README to remove references to deleted cleanup workflow
MariusStorhaug f2a2f89
Refactor: Update PR handling logic to use GitHub CLI and improve outp…
MariusStorhaug 0d74a48
Fix: Use Run command for GitHub CLI PR comments and closure
MariusStorhaug c257960
Fix: Update comment formatting in README for PR supersedence notifica…
MariusStorhaug 5f14a18
Merge branch 'main' into copilot/implement-font-data-pr-supersedence
MariusStorhaug f5e7d0c
Fix: Update README to clarify customization of PR supersedence closur…
MariusStorhaug File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| # 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 created | ||
| - **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**: 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 | ||
|
|
||
| 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) | ||
| - 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. | ||
| ``` | ||
| - All superseded 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. | ||
|
|
||
| ### 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: | ||
| - `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 | ||
|
|
||
| ### 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 can be | ||
| customized by modifying `scripts/Update-FontsData.ps1`. | ||
|
|
||
| ### 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo in command invocation:
Run h pr close ...callshinstead ofgh, which will fail with “command not found” and abort the workflow when trying to close superseded PRs. Update it to invoke the GitHub CLI (gh pr close).