5
0
Fork 0
mirror of https://github.com/wagoid/commitlint-github-action.git synced 2025-11-07 16:06:56 +00:00

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
This commit is contained in:
Wagner Santos 2019-11-30 11:14:04 -03:00
parent 5323f205d6
commit c1bba52d77

6
run.js
View file

@ -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,
}