File tree 3 files changed +46
-1
lines changed
3 files changed +46
-1
lines changed Original file line number Diff line number Diff line change
1
+ name : Create ES yearly globals
2
+
3
+ on :
4
+ workflow_dispatch :
5
+ schedule :
6
+ # “At 00:00 on day-of-month 1 in July.” https://crontab.guru/#0_0_1_7_*
7
+ - cron : " 0 0 1 7 *"
8
+
9
+ jobs :
10
+ update :
11
+ if : github.event_name != 'schedule' || github.repository == 'sindresorhus/globals'
12
+ runs-on : ubuntu-latest
13
+ steps :
14
+ - uses : actions/checkout@v4
15
+ - uses : actions/setup-node@v4
16
+ - run : npm install
17
+ - run : node scripts/create-yearly-es-globals.mjs
18
+ - run : npm run build
19
+ - uses : peter-evans/create-pull-request@v6
20
+ with :
21
+ commit-message : Add `es2026` globals
22
+ branch : automated-es-yearly-globals
23
+ branch-suffix : timestamp
24
+ title : Add `es2026` globals
Original file line number Diff line number Diff line change 20
20
- run : npm run update
21
21
- uses : peter-evans/create-pull-request@v6
22
22
with :
23
- commit-message : Update
23
+ commit-message : Update globals
24
24
branch : automated-update
25
25
branch-suffix : timestamp
26
26
title : Update globals
Original file line number Diff line number Diff line change
1
+ import fs from 'node:fs' ;
2
+
3
+ const year = new Date ( ) . getFullYear ( ) ;
4
+ const dataFile = new URL ( `../data/es${ year + 1 } .mjs` , import . meta. url ) ;
5
+ const workflowFile = new URL ( '../.github/workflows/es-yearly-globals.yml' , import . meta. url ) ;
6
+
7
+ fs . writeFileSync (
8
+ dataFile ,
9
+ `export {default} from './es${ year } .mjs';\n` ,
10
+ ) ;
11
+
12
+ fs . writeFileSync (
13
+ workflowFile ,
14
+ fs . readFileSync ( workflowFile , 'utf8' )
15
+ . replaceAll (
16
+ `Add \`es${ year + 1 } \` globals` ,
17
+ `Add \`es${ year + 2 } \` globals` ,
18
+ ) ,
19
+ ) ;
20
+
21
+ console . log ( `✅ es${ year + 1 } globals added, see you next year.` ) ;
You can’t perform that action at this time.
0 commit comments