This repository includes an automated workflow that keeps the timezones.db file up-to-date with the latest IANA timezone data.
- Go to the repository on GitHub
- Click on the "Actions" tab
- Select "Update Timezone Database" from the workflows list
- Click "Run workflow" button
- Select the branch (typically
main) - Click the green "Run workflow" button
The workflow runs automatically every Monday at 00:00 UTC (midnight). No manual intervention is required.
- Checks out gh-pages branch - Where the timezones.db file is stored
- Downloads latest timezone data - From https://data.iana.org/time-zones/releases/
- Version check - Compares downloaded version with existing file; skips update if unchanged
- Generates timezones.db - Processes the data using the update_timezones.py script (only if version changed)
- Validates the file - Ensures it has proper format and sufficient entries
- Commits changes - Only if the file has been updated
- Cleans up - Removes temporary files
The workflow validates that the generated file:
- Exists and has content
- Contains the expected header with tzdata version
- Has at least 100 timezone entries (sanity check)
- Follows the correct format:
Timezone/Name TZ_STRING
If the workflow fails, check the Actions tab for error logs:
- Download errors: IANA website may be temporarily unavailable
- Extraction errors: Downloaded file may be corrupted
- Validation errors: Generated file doesn't meet requirements
If you run the workflow but the file doesn't change:
- The timezone data version hasn't been updated since the last run
- Check the workflow run logs - should show "Timezone data is already up to date (version XXXX). No update needed."
- This is expected behavior and prevents unnecessary commits
To test the script locally:
python3 update_timezones.pyRequirements:
- Python 3.x
- wget
- tzdata package (for
zictool)
- Script:
update_timezones.py(main branch) - Workflow:
.github/workflows/update-timezones.yml(main branch) - Output:
timezones.db(gh-pages branch)