This directory contains scripts for automating the maintenance of the NerdFonts module.
This script automatically updates the src/FontsData.json file with the latest font metadata from the
ryanoasis/nerd-fonts repository.
- 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
- Scheduled Execution: The script runs daily at midnight UTC via the
Update-FontsDataworkflow - Data Fetching: Retrieves the latest font release metadata from the NerdFonts repository
- Change Detection: Compares new data with existing
FontsData.json - 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
- Creates a new branch named
- 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
- Ensures only the latest update PR remains open
- Searches for existing open PRs with titles matching
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:
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
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.
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
You can manually trigger an update using the GitHub Actions UI:
- Go to the Actions tab in the repository
- Select the Update-FontsData workflow
- Click Run workflow
- Select the branch and click Run workflow
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.
To test changes to the update script:
- Create a feature branch
- Modify
scripts/Update-FontsData.ps1 - Push the branch
- Manually trigger the workflow on your feature branch
- The script will detect it's running on a feature branch and update the existing branch instead of creating a new PR
- No updates available: If the NerdFonts release contains the same data, no PR will be created
- Authentication errors: Ensure the GitHub App credentials are correctly configured