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:
parent
5323f205d6
commit
c1bba52d77
1 changed files with 4 additions and 2 deletions
6
run.js
6
run.js
|
|
@ -56,13 +56,15 @@ const getRangeForEvent = async () => {
|
||||||
const commitShas = commits.map(commit => commit.sha)
|
const commitShas = commits.map(commit => commit.sha)
|
||||||
const [from] = commitShas
|
const [from] = commitShas
|
||||||
const to = commitShas[commitShas.length - 1]
|
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) {
|
function getHistoryCommits(from, to) {
|
||||||
const options = {
|
const options = {
|
||||||
from: from && `${from}^1`,
|
from,
|
||||||
to,
|
to,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue