From 46484f65ccefeac45654573633ab555ecf7c8a56 Mon Sep 17 00:00:00 2001 From: Andras Popovics Date: Thu, 11 Jan 2024 13:22:31 +0100 Subject: [PATCH] [AAE-19365] Fix for changelog generation --- lib/cli/scripts/changelog.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/cli/scripts/changelog.ts b/lib/cli/scripts/changelog.ts index 641f27f9275..f0096250445 100644 --- a/lib/cli/scripts/changelog.ts +++ b/lib/cli/scripts/changelog.ts @@ -23,6 +23,7 @@ import { argv, exit } from 'node:process'; import * as shell from 'shelljs'; import * as path from 'path'; import program from 'commander'; +import { logger } from './logger'; import * as fs from 'fs'; import * as ejs from 'ejs'; @@ -116,7 +117,15 @@ function getCommits(options: DiffOptions): Array { return log .split('\\n') - .map((str: string) => JSON.parse(str) as Commit) + .map((str: string) => { + try { + return JSON.parse(str) as Commit; + } catch (error) { + logger.error(`Unparsable commit message: ${str}, dropping it... Please apply manual fix.`); + return null; + } + }) + .filter((commit) => commit !== null) .filter((commit: Commit) => commitAuthorAllowed(commit, authorFilter)); }