From c1bba52d77fd4b35d15b07a6bea62c0d471be128 Mon Sep 17 00:00:00 2001 From: Wagner Santos Date: Sat, 30 Nov 2019 11:14:04 -0300 Subject: [PATCH] fix: do not try to get parent of push event's "before" field "before" field of a push event's payload already shows the commit before the push event was sent, so we can use it as "from" field of the revision. Fixes #18 --- run.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/run.js b/run.js index ead6296..2a630eb 100644 --- a/run.js +++ b/run.js @@ -56,13 +56,15 @@ const getRangeForEvent = async () => { const commitShas = commits.map(commit => commit.sha) const [from] = commitShas const to = commitShas[commitShas.length - 1] + // Git revision range doesn't include the "from" field in "git log", so for "from" we use the parent commit of PR's first commit + const fromParent = `${from}^1` - return [from, to] + return [fromParent, to] } function getHistoryCommits(from, to) { const options = { - from: from && `${from}^1`, + from, to, }