Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2e77644

Browse filesBrowse files
98lenviRafaelGSS
authored andcommitted
tools: add timezone update workflow
Fixes: #43134 PR-URL: #43988 Reviewed-By: Steven R Loomis <srloomis@us.ibm.com>
1 parent fcfdb6c commit 2e77644
Copy full SHA for 2e77644

File tree

Expand file treeCollapse file tree

2 files changed

+87
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+87
-0
lines changed
Open diff view settings
Collapse file
+48Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Timezone update
2+
on:
3+
schedule:
4+
# Run once a week at 00:05 AM UTC on Sunday.
5+
- cron: 5 0 * * 0
6+
7+
workflow_dispatch:
8+
9+
jobs:
10+
timezone_update:
11+
if: github.repository == 'nodejs/node'
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout nodejs/node
16+
uses: actions/checkout@v3
17+
with:
18+
persist-credentials: false
19+
20+
- name: Checkout unicode-org/icu-data
21+
uses: actions/checkout@v3
22+
with:
23+
path: icu-data
24+
persist-credentials: false
25+
repository: unicode-org/icu-data
26+
27+
- run: ./tools/update-timezone.mjs
28+
29+
- name: Open Pull Request
30+
uses: gr2m/create-or-update-pull-request-action@6720400cad8e74d7adc64640e4e6ea6748b83d8f # Create a PR or update the Action's existing PR
31+
env:
32+
GITHUB_TOKEN: ${{ secrets.GH_USER_TOKEN }}
33+
with:
34+
author: Node.js GitHub Bot <github-bot@iojs.org>
35+
body: |
36+
This PR was generated by tools/timezone-update.yml.
37+
38+
Updates the ICU files as per the instructions present in https://github.com/nodejs/node/blob/main/doc/contributing/maintaining-icu.md#time-zone-data
39+
40+
To test, build node off this branch & log the version of tz using
41+
```js
42+
console.log(process.versions.tz)
43+
```
44+
branch: actions/timezone-update
45+
commit-message: 'deps: update timezone'
46+
labels: dependencies
47+
title: 'deps: update timezone'
48+
reviewers: \@nodejs/i18n-api
Collapse file

‎tools/update-timezone.mjs‎

Copy file name to clipboard
+39Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/usr/bin/env node
2+
// Usage: tools/update-timezone.mjs
3+
import { execSync, spawnSync } from 'node:child_process';
4+
import { renameSync, readdirSync, rmSync } from 'node:fs';
5+
import { exit } from 'node:process';
6+
7+
const fileNames = [
8+
'zoneinfo64.res',
9+
'windowsZones.res',
10+
'timezoneTypes.res',
11+
'metaZones.res',
12+
];
13+
14+
const availableVersions = readdirSync('icu-data/tzdata/icunew', { withFileTypes: true })
15+
.filter((dirent) => dirent.isDirectory())
16+
.map((dirent) => dirent.name);
17+
18+
const currentVersion = process.versions.tz;
19+
const latestVersion = availableVersions.sort().at(-1);
20+
21+
if (latestVersion === currentVersion) {
22+
console.log(`Terminating early, tz version is latest @ ${currentVersion}`);
23+
exit();
24+
}
25+
26+
execSync('bzip2 -d deps/icu-small/source/data/in/icudt*.dat.bz2');
27+
fileNames.forEach((file) => {
28+
renameSync(`icu-data/tzdata/icunew/${latestVersion}/44/le/${file}`, `deps/icu-small/source/data/in/${file}`);
29+
spawnSync(
30+
'icupkg', [
31+
'-a',
32+
file,
33+
'icudt*.dat',
34+
], { cwd: 'deps/icu-small/source/data/in/' }
35+
);
36+
rmSync(`deps/icu-small/source/data/in/${file}`);
37+
});
38+
execSync('bzip2 -z deps/icu-small/source/data/in/icudt*.dat');
39+
rmSync('icu-data', { recursive: true });

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.