diff --git a/lib/workers/branch/check-existing.js b/lib/workers/branch/check-existing.js index 9701e088784a00542c9026774b38eedcf6190416..0b788635df70849c4fa1473590d773eb48f038b4 100644 --- a/lib/workers/branch/check-existing.js +++ b/lib/workers/branch/check-existing.js @@ -12,7 +12,10 @@ async function prAlreadyExisted(config) { // Return if same PR already existed // Check for current PR title format // See #1205 for why we check for !open or closed - const statusValue = config.packageFiles.length === 1 ? '!open' : 'closed'; + const statusValue = + config.packageFiles && config.packageFiles.length === 1 + ? '!open' + : 'closed'; let pr = await platform.findPr( config.branchName, config.prTitle, diff --git a/lib/workers/branch/commit.js b/lib/workers/branch/commit.js index b3b8ff1ed6dcfdae551cf0b1388632647549e577..135b5b6ba1731310838bbd60a7ff6a6b9e4b2569 100644 --- a/lib/workers/branch/commit.js +++ b/lib/workers/branch/commit.js @@ -8,7 +8,7 @@ async function commitFilesToBranch(config) { const updatedFiles = config.updatedPackageFiles.concat( config.updatedLockFiles ); - if (updatedFiles.length) { + if (updatedFiles && updatedFiles.length) { logger.debug(`${updatedFiles.length} file(s) to commit`); let commitMessage = handlebars.compile(config.commitMessage)(config); if (config.semanticCommits) { diff --git a/lib/workers/branch/index.js b/lib/workers/branch/index.js index 00476b7de2d871fe910fb39ca86aa28c7415b1c4..f32a4a597a9b8cabbce383b0a516bdbb633fd5da 100644 --- a/lib/workers/branch/index.js +++ b/lib/workers/branch/index.js @@ -35,7 +35,9 @@ async function processBranch(branchConfig) { return 'pr-hourly-limit-reached'; } try { - logger.info(`Branch has ${dependencies.length} upgrade(s)`); + logger.info( + `Branch has ${dependencies ? dependencies.length : 0} upgrade(s)` + ); // Check if branch already existed let pr = await prAlreadyExisted(config); @@ -118,7 +120,7 @@ async function processBranch(branchConfig) { Object.assign(config, await getParentBranch(config)); logger.debug(`Using parentBranch: ${config.parentBranch}`); Object.assign(config, await getUpdatedPackageFiles(config)); - if (config.updatedPackageFiles.length) { + if (config.updatedPackageFiles && config.updatedPackageFiles.length) { logger.debug( { updatedPackageFiles: config.updatedPackageFiles }, `Updated ${config.updatedPackageFiles.length} package files` @@ -127,7 +129,7 @@ async function processBranch(branchConfig) { logger.debug('No package files need updating'); } Object.assign(config, await getUpdatedLockFiles(config)); - if (config.updatedLockFiles.length) { + if (config.updatedLockFiles && config.updatedLockFiles.length) { logger.debug( { updatedLockFiles: config.updatedLockFiles.map(f => f.name) }, `Updated ${config.updatedLockFiles.length} lock files` diff --git a/lib/workers/branch/lock-files.js b/lib/workers/branch/lock-files.js index a11db9a8b43fb371bcfcf42a73054670bc22e1b2..385aeee1b593644acb108379c969fe893ed283b1 100644 --- a/lib/workers/branch/lock-files.js +++ b/lib/workers/branch/lock-files.js @@ -435,7 +435,7 @@ async function getUpdatedLockFiles(config) { } } - if (dirs.lernaDirs.length) { + if (dirs.lernaDirs && dirs.lernaDirs.length) { let manager; let lockFile; if (config.lernaLockFile === 'npm') {