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

Merge pull request #19 from wagoid/fix/do-not-get-parent-of-push-before-field

fix: do not try to get parent of push event's "before" field
This commit is contained in:
Wagner Santos 2019-11-30 11:23:24 -03:00 committed by GitHub
commit 55cae67a2d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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