release notes vN (#11077)

Make it more likely the draft release notes work...

Release Notes:

- N/A
This commit is contained in:
Conrad Irwin 2024-04-26 17:18:17 -06:00 committed by GitHub
parent 8e925bf58f
commit 848bb97ba7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -27,13 +27,18 @@ async function main() {
if (parts[2] == 0) {
priorVersion = [parts[0], parts[1] - 1, 0].join(".");
}
} else if (!tagExists("v${priorVersion}")) {
} else if (!ensureTag(`v${priorVersion}`)) {
console.log("Copy the release notes from preview.");
process.exit(0);
}
let [tag, priorTag] = [`v${version}${suffix}`, `v${priorVersion}${suffix}`];
if (!ensureTag(tag) || !ensureTag(priorTag)) {
console.log("Could not draft release notes, missing a tag:", tag, priorTag);
process.exit(0);
}
const newCommits = getCommits(priorTag, tag);
let releaseNotes = [];
@ -99,11 +104,17 @@ function getCommits(oldTag, newTag) {
return pullRequestNumbers;
}
function tagExists(tag) {
function ensureTag(tag) {
try {
execFileSync("git", ["rev-parse", "--verify", tag]);
return true;
} catch (e) {
return false;
try {
execFileSync("git"[("fetch", "origin", "--shallow-exclude", tag)]);
execFileSync("git"[("fetch", "origin", "--deepen", "1")]);
return true;
} catch (e) {
return false;
}
}
}