-
Notifications
You must be signed in to change notification settings - Fork 0
107 lines (88 loc) · 3.27 KB
/
update-tzdb.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
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