Skip to content

Commit 48e783f

Browse files
Delay the kick-off date for the webplat relnotes (#3697)
1 parent f67d321 commit 48e783f

1 file changed

Lines changed: 25 additions & 12 deletions

File tree

scripts/web-platform-release-notes.js

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,22 @@ import fs from "fs/promises";
77
import playwright from "playwright";
88
import { execSync } from 'child_process';
99

10+
// If the number of days before the next Beta is lower or equal to DAYS_NUMBER_BEFORE_RELNOTES_NOTICE
11+
// then we start generating the Beta release notes.
12+
// This gives us time to edit, review, and publish the Beta release notes before Beta comes out.
13+
// This number used to be 15, which was too much because features were still moving in and out of
14+
// the next Beta milestone on chromestatus.com.
15+
// The number is now set to 7 days, which should reduce the number of last-minute changes we need to do.
16+
const DAYS_NUMBER_BEFORE_RELNOTES_NOTICE = 7;
17+
1018
// Where to find Edge-only origin trials info.
1119
const EDGE_OT_ROOT = "https://developer.microsoft.com/en-us";
1220
const EDGE_OT_PAGE = `${EDGE_OT_ROOT}/microsoft-edge/origin-trials/trials`;
13-
// If Beta becomes stable within the next N coming days, generate the release notes for Canary.
14-
// This way, the release notes are ready for when Canary becomes Beta.
15-
const DAYS_NUMBER_BEFORE_RELNOTES_NOTICE = 15;
21+
1622
// The prefix to use when creating a new git branch for the release notes draft.
1723
const BRANCH_NAME_PREFIX = "web-platform-release-notes-";
1824

25+
// Call a chromestatus.com API endpoint and return the parsed JSON data.
1926
async function fetchChromeStatusAPI(url) {
2027
const response = await fetch(url);
2128
let text = await response.text();
@@ -24,6 +31,7 @@ async function fetchChromeStatusAPI(url) {
2431
return data;
2532
}
2633

34+
// Format a date string as "Month Day, Year", e.g., "January 15, 2024".
2735
function longDate(dateString) {
2836
const date = new Date(dateString);
2937
return date.toLocaleString("en-US", {
@@ -33,6 +41,7 @@ function longDate(dateString) {
3341
});
3442
}
3543

44+
// Execute a shell command and return the stdout as a string.
3645
async function execute(cmd) {
3746
try {
3847
const stdout = await execSync(cmd);
@@ -44,7 +53,8 @@ async function execute(cmd) {
4453
}
4554
}
4655

47-
async function releaseNotesAlreadyExists(version) {
56+
// Check if the release notes for the given version already exist in the main branch.
57+
async function doesReleaseNotesAlreadyExist(version) {
4858
const response = await fetch(`https://raw.githubusercontent.com/MicrosoftDocs/edge-developer/refs/heads/main/microsoft-edge/web-platform/release-notes/${version}.md`);
4959

5060
// Github.com normally responds with 404 if the file doesn't exist. So this should catch it.
@@ -57,7 +67,8 @@ async function releaseNotesAlreadyExists(version) {
5767
return text.includes(`Microsoft Edge ${version} web platform release notes`);
5868
}
5969

60-
async function releaseNotesDraftAlreadyExists(version, branchName) {
70+
// Check if a draft release notes for the given version already exist in the given branch.
71+
async function doesReleaseNotesDraftExist(version, branchName) {
6172
const response = await fetch(`https://raw.githubusercontent.com/MicrosoftDocs/edge-developer/refs/heads/${branchName}/microsoft-edge/web-platform/release-notes/${version}.md`);
6273

6374
// Github.com normally responds with 404 if the file doesn't exist. So this should catch it.
@@ -70,10 +81,7 @@ async function releaseNotesDraftAlreadyExists(version, branchName) {
7081
return text.includes(`Microsoft Edge ${version} web platform release notes`);
7182
}
7283

73-
function getReleaseNoteMDFilePath(version, branchName) {
74-
return `https://github.com/MicrosoftDocs/edge-developer/blob/${branchName}/microsoft-edge/web-platform/release-notes/${version}.md`;
75-
}
76-
84+
// Get the list of currently active Edge-only origin trials by scraping the Edge OT page.
7785
async function getActiveEdgeOTs() {
7886
const scrapingBrowser = await playwright.chromium.launch({ headless: true });
7987
const context = await scrapingBrowser.newContext();
@@ -158,6 +166,7 @@ async function getActiveEdgeOTs() {
158166
return ots;
159167
}
160168

169+
// Main entry point to this script.
161170
async function main() {
162171
// --------------------------------------------------
163172
// 1. Check which is the next release (first date that's in the future compared to today).
@@ -212,13 +221,13 @@ async function main() {
212221
// 2. Check if there isn't already a published or draft release notes for the next beta version.
213222
// --------------------------------------------------
214223

215-
const alreadyExists = await releaseNotesAlreadyExists(nextBetaVersion);
224+
const alreadyExists = await doesReleaseNotesAlreadyExist(nextBetaVersion);
216225
if (alreadyExists) {
217226
console.error(`Release notes for the next beta version ${nextBetaVersion} already exist.`);
218227
process.exit(0);
219228
}
220229

221-
const draftAlreadyExists = await releaseNotesDraftAlreadyExists(nextBetaVersion, branchName);
230+
const draftAlreadyExists = await doesReleaseNotesDraftExist(nextBetaVersion, branchName);
222231
if (draftAlreadyExists) {
223232
console.error(`Draft release notes for the next beta version ${nextBetaVersion} already exist on the ${branchName} branch.`);
224233
process.exit(0);
@@ -363,8 +372,12 @@ async function main() {
363372
// --------------------------------------------------
364373

365374
console.log("Opening an issue to notify the team about the new release notes draft.");
375+
376+
const fileSourceLink = `https://github.com/MicrosoftDocs/edge-developer/blob/${branchName}/microsoft-edge/web-platform/release-notes/${nextBetaVersion}.md`;
377+
366378
const title = `Microsoft Edge Beta ${nextBetaVersion} web platform release notes ready for review`;
367-
const body = `The release notes draft for the next Microsoft Edge beta version ${nextBetaVersion} has been generated in [${nextBetaVersion}.md](${getReleaseNoteMDFilePath(nextBetaVersion, branchName)}) on the ${branchName} branch.\n\nPlease [create a pull request](https://github.com/MicrosoftDocs/edge-developer/compare/main...${branchName}), update the content as needed, and close this issue.`;
379+
let body = `The release notes draft for the next Microsoft Edge beta version ${nextBetaVersion} has been generated in [${nextBetaVersion}.md](${fileSourceLink}) on the ${branchName} branch.\n\n`;
380+
body += `Please [create a pull request](https://github.com/MicrosoftDocs/edge-developer/compare/main...${branchName}), update the content as needed, and then close this issue.`;
368381

369382
const octokit = github.getOctokit(process.env.token);
370383
await octokit.rest.issues.create({

0 commit comments

Comments
 (0)