From cc1325d6f92477a9639c82ce96fe8dcc61730813 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Wed, 2 Nov 2022 10:55:48 -0700 Subject: [PATCH] Adjust script for getting changes to put in release notes Now, this script is only useful for the preview channel's releases. The stable channel's release notes can be mostly copied from the existing preview releases notes. Co-authored-by: Joseph Lyons --- ...st-release => get-preview-channel-changes} | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) rename script/{changes-since-last-release => get-preview-channel-changes} (74%) diff --git a/script/changes-since-last-release b/script/get-preview-channel-changes similarity index 74% rename from script/changes-since-last-release rename to script/get-preview-channel-changes index 23a65143b2..ac1dcb5b6e 100755 --- a/script/changes-since-last-release +++ b/script/get-preview-channel-changes @@ -8,14 +8,14 @@ const FIXES_REGEX = /(fixes|closes) (.+[/#]\d+.*)$/im; main(); async function main() { - // Get the last two tags + // Get the last two preview tags const [newTag, oldTag] = execFileSync( "git", ["tag", "--sort", "-committerdate"], { encoding: "utf8" } ) .split("\n") - .filter((t) => t.startsWith("v")); + .filter((t) => t.startsWith("v") && t.endsWith('-pre')); // Print the previous release console.log(`Changes from ${oldTag} to ${newTag}\n`); @@ -49,9 +49,28 @@ async function main() { .filter((line) => line.length > 0) .map((line) => line.match(PR_REGEX)[1]); + // Get the PRs that were cherry-picked between main and the old tag. + const existingPullRequestNumbers = new Set(execFileSync( + "git", + [ + "log", + `main..${oldTag}`, + "--oneline", + "--grep", + "Merge pull request", + ], + { encoding: "utf8" } + ) + .split("\n") + .filter((line) => line.length > 0) + .map((line) => line.match(PR_REGEX)[1])); + + // Filter out those existing PRs from the set of new PRs. + const newPullRequestNumbers = pullRequestNumbers.filter(number => !existingPullRequestNumbers.has(number)); + // Fetch the pull requests from the GitHub API. console.log("Merged Pull requests:") - for (const pullRequestNumber of pullRequestNumbers) { + for (const pullRequestNumber of newPullRequestNumbers) { const webURL = `https://github.com/zed-industries/zed/pull/${pullRequestNumber}`; const apiURL = `https://api.github.com/repos/zed-industries/zed/pulls/${pullRequestNumber}`;