-
Notifications
You must be signed in to change notification settings - Fork 6
91 lines (73 loc) · 3.99 KB
/
release-calendar-events.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
name: Release Calendar Events
on:
workflow_dispatch:
inputs:
major:
description: Electron major (e.g. 30)
required: true
type: string
permissions: {}
jobs:
generate-calendar-events:
name: Generate Calendar Events
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
script: |
const fs = require('node:fs/promises');
const INITIAL_MILESTONE = 64;
const major = ${{ github.event.inputs.major }};
const milestone = INITIAL_MILESTONE + major*2;
const events = [['Subject', 'Start Date', 'End Date', 'All Day Event']];
// Events for the beta milestone
{
const res = await fetch(`https://chromiumdash.appspot.com/fetch_milestone_schedule?mstone=${milestone - 1}`);
const stableDate = new Date((await res.json()).mstones[0].stable_date);
if (stableDate.getDay() !== 2) {
throw new Error(`Expected stable date to be a Tuesday: ${stableDate}`);
}
let date = stableDate.toISOString().split('T')[0];
events.push([`${major}.0.0-beta.1 (M${milestone - 1})`, date, date, 'True']);
const kickOffDate = new Date(stableDate);
kickOffDate.setDate(kickOffDate.getDate() - 1);
date = kickOffDate.toISOString().split('T')[0];
events.push([`Action: Kick Off ${major}.0.0-beta.1`, date, date, 'True']);
}
// Events for the main milestone
{
const res = await fetch(`https://chromiumdash.appspot.com/fetch_milestone_schedule?mstone=${milestone}`);
const stableDate = new Date((await res.json()).mstones[0].stable_date);
if (stableDate.getDay() !== 2) {
throw new Error(`Expected stable date to be a Tuesday: ${stableDate}`);
}
let date = stableDate.toISOString().split('T')[0];
events.push([`✨${major}.0.0 Stable✨ (M${milestone})`, date, date, 'True']);
const kickOffStableDate = new Date(stableDate);
kickOffStableDate.setDate(kickOffStableDate.getDate() - 1);
date = kickOffStableDate.toISOString().split('T')[0];
events.push([`Action: Kick Off ${major}.0.0`, date, date, 'True']);
const kickOffAlphaDate = new Date(stableDate);
kickOffAlphaDate.setDate(kickOffAlphaDate.getDate() + 1);
date = kickOffAlphaDate.toISOString().split('T')[0];
events.push([`Action: Kick Off ${major + 1}.0.0-alpha.1`, date, date, 'True']);
const alphaDate = new Date(kickOffAlphaDate);
alphaDate.setDate(alphaDate.getDate() + 1);
date = alphaDate.toISOString().split('T')[0];
events.push([`${major + 1}.0.0-alpha.1`, date, date, 'True']);
const stableWeekDate = new Date(kickOffStableDate);
stableWeekDate.setDate(stableWeekDate.getDate() - 7);
const startDate = stableWeekDate.toISOString().split('T')[0];
stableWeekDate.setDate(stableWeekDate.getDate() + 5);
const endDate = stableWeekDate.toISOString().split('T')[0];
events.push(['Stable Prep Week', startDate, endDate, 'True']);
const stablePrepAssign = new Date(kickOffAlphaDate);
stablePrepAssign.setDate(stablePrepAssign.getDate() - 14);
date = stablePrepAssign.toISOString().split('T')[0];
events.push(['Action: Stable Prep Assignment', date, date, 'True']);
}
await fs.writeFile(`e${major}-calendar-events.csv`, events.flatMap((row) => row.join(',')).join('\n'));
- uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
with:
name: Calendar Events E${{ github.event.inputs.major }}
path: e${{ github.event.inputs.major }}-calendar-events.csv