From ce8ce887d703215211fb4d753725c22efb2c4b4b Mon Sep 17 00:00:00 2001 From: Rhys Arkins Date: Thu, 9 Jul 2020 07:44:55 +0200 Subject: [PATCH] fix(github): harden commit checks --- lib/platform/github/index.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/platform/github/index.ts b/lib/platform/github/index.ts index 8811189921db3b..f7794ca2f61d54 100644 --- a/lib/platform/github/index.ts +++ b/lib/platform/github/index.ts @@ -663,7 +663,8 @@ async function getOpenPrs(): Promise { if (pr.commits.nodes.length === 1) { if (global.gitAuthor) { // Check against gitAuthor - const commitAuthorEmail = pr.commits.nodes[0].commit.author.email; + const commitAuthorEmail = + pr.commits?.nodes?.[0]?.commit?.author?.email; if (commitAuthorEmail === global.gitAuthor.email) { pr.isModified = false; } else { @@ -700,9 +701,8 @@ async function getOpenPrs(): Promise { } else { const baseCommitSHA = await getBaseCommitSHA(); if ( - pr.commits.nodes[0].commit.parents.edges.length && - pr.commits.nodes[0].commit.parents.edges[0].node.oid !== - baseCommitSHA + pr.commits?.nodes[0]?.commit?.parents?.edges?.[0]?.node?.oid !== + baseCommitSHA ) { pr.isStale = true; }