diff --git a/lib/configManager.js b/lib/configManager.js index 58f5bb43..a5e1d214 100644 --- a/lib/configManager.js +++ b/lib/configManager.js @@ -21,8 +21,13 @@ module.exports = class ConfigManager { const params = Object.assign(repo, { path: filePath, ref: this.ref }) const response = await this.context.octokit.repos.getContent(params).catch(e => { this.log.error(`Error getting settings ${e}`) + return null }) + if (!response) { + return null + } + // Ignore in case path is a folder // - https://developer.github.com/v3/repos/contents/#response-if-content-is-a-directory if (Array.isArray(response.data)) { diff --git a/lib/settings.js b/lib/settings.js index 6c42e439..25582560 100644 --- a/lib/settings.js +++ b/lib/settings.js @@ -203,7 +203,7 @@ class Settings { if (!stats.errors[res.repo]) { stats.errors[res.repo] = [] } - stats.errors[res.repo].push(res.action) + stats.errors[res.repo].push(res.action ?? { msg: 'Unknown error' }) } else if (!(res.action?.additions === null && res.action?.deletions === null && res.action?.modifications === null)) { if (!stats.changes[res.plugin]) { stats.changes[res.plugin] = {} @@ -211,7 +211,7 @@ class Settings { if (!stats.changes[res.plugin][res.repo]) { stats.changes[res.plugin][res.repo] = [] } - stats.changes[res.plugin][res.repo].push(`${res.action}`) + stats.changes[res.plugin][res.repo].push(res.action ?? { msg: 'No action details' }) } } }) @@ -242,16 +242,18 @@ ${this.results.reduce((x, y) => { if (!y) { return x } + // Skip results that don't have an action property or have undefined action + if (!y.action) { + return x + } + 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) { - return `${x}` + return x } else { - if (y.action === undefined) { - return `${x}` - } return `${x} ✋ ${y.plugin} ${prettify(y.repo)} ${prettify(y.action.additions)} ${prettify(y.action.deletions)} ${prettify(y.action.modifications)} ` }