mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-12 21:32:40 +00:00
Fix get preview channel changes script
This commit is contained in:
parent
d5cf595761
commit
c701901c7b
1 changed files with 36 additions and 33 deletions
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
const { execFileSync } = require("child_process");
|
const { execFileSync } = require("child_process");
|
||||||
const { GITHUB_ACCESS_TOKEN } = process.env;
|
const { GITHUB_ACCESS_TOKEN } = process.env;
|
||||||
const PR_REGEX = /pull request #(\d+)/;
|
const PR_REGEX = /#\d+/ // Ex: matches on #4241
|
||||||
const FIXES_REGEX = /(fixes|closes) (.+[/#]\d+.*)$/im;
|
const FIXES_REGEX = /(fixes|closes|completes) (.+[/#]\d+.*)$/im;
|
||||||
|
|
||||||
main();
|
main();
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ async function main() {
|
||||||
{ encoding: "utf8" }
|
{ encoding: "utf8" }
|
||||||
)
|
)
|
||||||
.split("\n")
|
.split("\n")
|
||||||
.filter((t) => t.startsWith("v") && t.endsWith('-pre'));
|
.filter((t) => t.startsWith("v") && t.endsWith("-pre"));
|
||||||
|
|
||||||
// Print the previous release
|
// Print the previous release
|
||||||
console.log(`Changes from ${oldTag} to ${newTag}\n`);
|
console.log(`Changes from ${oldTag} to ${newTag}\n`);
|
||||||
|
@ -34,36 +34,10 @@ async function main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the PRs merged between those two tags.
|
// Get the PRs merged between those two tags.
|
||||||
const pullRequestNumbers = execFileSync(
|
const pullRequestNumbers = getPullRequestNumbers(oldTag, newTag)
|
||||||
"git",
|
|
||||||
[
|
|
||||||
"log",
|
|
||||||
`${oldTag}..${newTag}`,
|
|
||||||
"--oneline",
|
|
||||||
"--grep",
|
|
||||||
"Merge pull request",
|
|
||||||
],
|
|
||||||
{ encoding: "utf8" }
|
|
||||||
)
|
|
||||||
.split("\n")
|
|
||||||
.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.
|
// Get the PRs that were cherry-picked between main and the old tag.
|
||||||
const existingPullRequestNumbers = new Set(execFileSync(
|
const existingPullRequestNumbers = new Set(getPullRequestNumbers("main", oldTag))
|
||||||
"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.
|
// Filter out those existing PRs from the set of new PRs.
|
||||||
const newPullRequestNumbers = pullRequestNumbers.filter(number => !existingPullRequestNumbers.has(number));
|
const newPullRequestNumbers = pullRequestNumbers.filter(number => !existingPullRequestNumbers.has(number));
|
||||||
|
@ -86,10 +60,39 @@ async function main() {
|
||||||
console.log(" URL: ", webURL);
|
console.log(" URL: ", webURL);
|
||||||
|
|
||||||
// If the pull request contains a 'closes' line, print the closed issue.
|
// If the pull request contains a 'closes' line, print the closed issue.
|
||||||
const fixesMatch = (pullRequest.body || '').match(FIXES_REGEX);
|
const fixesMatch = (pullRequest.body || "").match(FIXES_REGEX);
|
||||||
if (fixesMatch) {
|
if (fixesMatch) {
|
||||||
const fixedIssueURL = fixesMatch[2];
|
const fixedIssueURL = fixesMatch[2];
|
||||||
console.log(" Issue: ", fixedIssueURL);
|
console.log(" Issue: ", fixedIssueURL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let releaseNotes = (pullRequest.body || "").split("Release Notes:")[1];
|
||||||
|
|
||||||
|
if (releaseNotes) {
|
||||||
|
releaseNotes = releaseNotes.trim()
|
||||||
|
console.log(" Release Notes:");
|
||||||
|
console.log(` ${releaseNotes}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getPullRequestNumbers(oldTag, newTag) {
|
||||||
|
const pullRequestNumbers = execFileSync(
|
||||||
|
"git",
|
||||||
|
[
|
||||||
|
"log",
|
||||||
|
`${oldTag}..${newTag}`,
|
||||||
|
"--oneline"
|
||||||
|
],
|
||||||
|
{ encoding: "utf8" }
|
||||||
|
)
|
||||||
|
.split("\n")
|
||||||
|
.filter(line => line.length > 0)
|
||||||
|
.map(line => {
|
||||||
|
const match = line.match(/#(\d+)/);
|
||||||
|
return match ? match[1] : null;
|
||||||
|
})
|
||||||
|
.filter(line => line)
|
||||||
|
|
||||||
|
return pullRequestNumbers
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue