chore: improve changelog generator

This commit is contained in:
Koen Kanters
2024-06-30 21:50:33 +02:00
parent 8196460de0
commit 2885eee795
+6 -2
View File
@@ -36,6 +36,8 @@ if (fs.existsSync(commitUserFile)) {
commitUserLookup = JSON.parse(fs.readFileSync(commitUserFile, 'utf8'));
}
const whiteLabels = zhc.definitions.filter((d) => d.whiteLabel).flatMap((d) => d.whiteLabel);
for (const changelog of changelogs) {
for (const line of changelog.contents) {
const releaseMatch = line.match(releaseRe);
@@ -77,8 +79,10 @@ for (const changelog of changelogs) {
if (localContext === 'add') {
for (const model of message.split(',')) {
const definition = zhc.definitions.find((d) => d.model === model.trim());
if (definition) {
messages.push(`\`${definition.model}\` ${definition.vendor} ${definition.description}`);
const whiteLabel = whiteLabels.find((d) => d.model === model.trim());
const match = definition || whiteLabel;
if (match) {
messages.push(`\`${match.model}\` ${match.vendor} ${match.description}`);
} else {
changes['error'].push(`${line} (model '${model}' does not exist)`);
}