chore: improve changelog generator

This commit is contained in:
koenkk
2023-06-08 09:20:42 +02:00
parent a7e02a7be8
commit 5f71776434
+5 -2
View File
@@ -42,7 +42,7 @@ for (const changelog of changelogs) {
} else if (line.startsWith('* **ignore:**')) {
continue;
} else if (changeMatch) {
const localContext = changeMatch[2] ? changeMatch[2] : context;
let localContext = changeMatch[2] ? changeMatch[2] : context;
if (!changes[localContext]) throw new Error(`Unknown context: ${localContext}`);
let user = execSync(`curl -s https://api.github.com/repos/${changelog.project}/commits/${changeMatch[5]} | jq -r '.author.login'`).toString().trim();
@@ -72,7 +72,10 @@ for (const changelog of changelogs) {
let issue = changeMatch[4].trim();
if (issue && !issue.startsWith('[#')) issue = `[#${issue.split('/').pop()}](${issue})`;
if (!issue) issue = '_NO_ISSUE_';
if (!issue) {
issue = '_NO_ISSUE_';
localContext = 'error';
}
messages.forEach((m) => changes[localContext].push(`- ${issue} ${m} (@${user})`));
} else if (line === '# Changelog' || !line) {