Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/configManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
14 changes: 8 additions & 6 deletions lib/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,15 +203,15 @@ 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] = {}
}
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' })
}
}
})
Expand Down Expand Up @@ -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}
<tr><td> ❗ ${y.action.msg} </td><td> ${y.plugin} </td><td> ${prettify(y.repo)} </td><td> ${prettify(y.action.additions)} </td><td> ${prettify(y.action.deletions)} </td><td> ${prettify(y.action.modifications)} </td><tr>`
} 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}
<tr><td> ✋ </td><td> ${y.plugin} </td><td> ${prettify(y.repo)} </td><td> ${prettify(y.action.additions)} </td><td> ${prettify(y.action.deletions)} </td><td> ${prettify(y.action.modifications)} </td><tr>`
}
Expand Down