Skip to content

Commit c1bba52

Browse files
committed
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
1 parent 5323f20 commit c1bba52

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

run.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,15 @@ const getRangeForEvent = async () => {
5656
const commitShas = commits.map(commit => commit.sha)
5757
const [from] = commitShas
5858
const to = commitShas[commitShas.length - 1]
59+
// 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
60+
const fromParent = `${from}^1`
5961

60-
return [from, to]
62+
return [fromParent, to]
6163
}
6264

6365
function getHistoryCommits(from, to) {
6466
const options = {
65-
from: from && `${from}^1`,
67+
from,
6668
to,
6769
}
6870

0 commit comments

Comments
 (0)