Hopefully fixed commit parsing

This commit is contained in:
yairm210
2024-08-14 11:04:02 +03:00
parent adc389f5d6
commit 04f1508dfa

View File

@ -58,7 +58,7 @@ async function parseCommits() {
if (commitMessage.startsWith("Merge ") || commitMessage.startsWith("Update ")) return; if (commitMessage.startsWith("Merge ") || commitMessage.startsWith("Update ")) return;
commitMessage = commitMessage.replace(/\(\#\d+\)/, "").replace(/\#\d+/, ""); // match PR auto-text, like (#2345) or just #2345 commitMessage = commitMessage.replace(/\(\#\d+\)/, "").replace(/\#\d+/, ""); // match PR auto-text, like (#2345) or just #2345
if (author !== "yairm210") { if (author !== "yairm210") {
if (typeof ownerToCommits[author] === "undefined") ownerToCommits[author] = []; if (!(author in ownerToCommits)) ownerToCommits[author] = [];
ownerToCommits[author].push(commitMessage); ownerToCommits[author].push(commitMessage);
} else { } else {
commitSummary += "\n\n" + commitMessage; commitSummary += "\n\n" + commitMessage;
@ -66,14 +66,14 @@ async function parseCommits() {
} }
); );
Object.entries(ownerToCommits).forEach((author,index, commits) => { for (const [author, commits] of Object.entries(ownerToCommits)) {
if (commits.length === 1) { if (commits.length === 1) {
commitSummary += "\n\n" + commits[0] + " - By " + author; commitSummary += "\n\n" + commits[0] + " - By " + author;
} else { } else {
commitSummary += "\n\nBy " + author + ":"; commitSummary += "\n\nBy " + author + ":";
commits.forEach(commitMessage => { commitSummary += "\n- " + commitMessage }); commits.forEach(commitMessage => { commitSummary += "\n- " + commitMessage });
} }
}) }
console.log(commitSummary); console.log(commitSummary);
return [nextVersionString, commitSummary]; return [nextVersionString, commitSummary];
} }