From 35772bad09117317a5de60acb7cfa855843a5e97 Mon Sep 17 00:00:00 2001 From: Mario Nebl Date: Thu, 3 Jul 2025 10:27:08 +0200 Subject: [PATCH] fix: guard against result.action being undefined I've observed the following recurring exception in handling `check_run` events. The stack trace indicates we're trying to read from `action` when it isn't defined. | This accepts potentially partial check messages instead of crashing the event processing. ``` TypeError: Cannot read properties of undefined (reading 'additions') ~~~~~ redacted ~~~~~ at Array.reduce () at _Settings.handleResults ( ~~~~~ redacted ~~~~~) ``` --- lib/settings.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/settings.js b/lib/settings.js index 20e71167..8d268fc9 100644 --- a/lib/settings.js +++ b/lib/settings.js @@ -245,8 +245,8 @@ ${this.results.reduce((x, y) => { if (y.type === 'ERROR') { error = true return `${x} - ❗ ${y.action.msg} ${y.plugin} ${prettify(y.repo)} ${prettify(y.action.additions)} ${prettify(y.action.deletions)} ${prettify(y.action.modifications)} ` - } else if (y.action.additions === null && y.action.deletions === null && y.action.modifications === null) { + ❗ ${y.action?.msg} ${y.plugin} ${prettify(y.repo)} ${prettify(y.action?.additions)} ${prettify(y.action?.deletions)} ${prettify(y.action?.modifications)} ` + } else if (y.action?.additions === null && y.action?.deletions === null && y.action?.modifications === null) { return `${x}` } else { if (y.action === undefined) {