Skip to content

Update TZDB

Update TZDB #14

Workflow file for this run

name: Update TZDB
on:
schedule:
# Run daily at 00:00 UTC
- cron: '0 0 * * *'
workflow_dispatch: # Allow manual trigger
repository_dispatch:
types: [tzdb-update]
jobs:
check-and-update:
name: Check and Update TZDB
runs-on: macos-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Select Xcode
run: |
sudo xcode-select -s /Applications/Xcode_16.1.app
swift --version
- name: Install pkl
run: |
brew install pkl
pkl --version
- name: Download current zonenow.tab
run: |
curl -o zonenow.tab.new https://raw.githubusercontent.com/eggert/tz/main/zonenow.tab
curl -o zone1970.tab.new https://raw.githubusercontent.com/eggert/tz/main/zone1970.tab
- name: Check for changes
id: check
run: |
changes_detected=false
if [ ! -f "zonenow.tab" ] || ! cmp -s "zonenow.tab" "zonenow.tab.new"; then
echo "Changes detected in zonenow.tab"
mv zonenow.tab.new zonenow.tab
changes_detected=true
else
echo "No changes detected in zonenow.tab"
fi
if [ ! -f "zone1970.tab" ] || ! cmp -s "zone1970.tab" "zone1970.tab.new"; then
echo "Changes detected in zone1970.tab"
mv zone1970.tab.new zone1970.tab
changes_detected=true
else
echo "No changes detected in zone1970.tab"
fi
echo "changes_detected=$changes_detected" >> $GITHUB_OUTPUT
- name: Build project
if: steps.check.outputs.changes_detected == 'true'
run: swift build
- name: Generate updated timezone data
if: steps.check.outputs.changes_detected == 'true'
run: swift run SwiftTZGenerator
- name: Create Pull Request
if: steps.check.outputs.changes_detected == 'true'
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "[Automated] Update Time Zone Database"
title: "[Automated] Update Time Zone Database"
body: |
This PR updates the timezone database based on changes in the IANA tzdb.
Changes were automatically detected and generated using the `SwiftTZGenerator` tool.
### Changes
<details>
<summary>View changes</summary>
```diff
# zonenow.tab changes
$(diff -u zonenow.tab.new zonenow.tab || true)
# zone1970.tab changes
$(diff -u zone1970.tab.new zone1970.tab || true)
```
</details>
- Updated `zonenow.tab` and/or `zone1970.tab` from IANA
- Regenerated PKL schema
- Updated Swift generated code
Please review the changes and merge if everything looks correct.
branch: update-tzdb
base: main
labels: |
automated
tzdb-update
patch
release
delete-branch: true