fix/resolve bug fetching more history (#1176)

Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
Tonye Jack
2023-05-25 21:14:24 -06:00
committed by GitHub
parent 77f872a759
commit 25eaddf37a
7 changed files with 71 additions and 55 deletions

View File

@@ -137,7 +137,7 @@ export const getSHAForPushEvent = async (
}
await verifyCommitSha({sha: previousSha, cwd: workingDirectory})
core.info(`Previous SHA: ${previousSha}`)
core.debug(`Previous SHA: ${previousSha}`)
return {
previousSha,
@@ -177,10 +177,6 @@ export const getSHAForPushEvent = async (
core.debug('Getting previous SHA for last remote commit...')
if (env.GITHUB_EVENT_FORCED === 'false' || !env.GITHUB_EVENT_FORCED) {
previousSha = env.GITHUB_EVENT_BEFORE
} else {
previousSha = await getParentSha({
cwd: workingDirectory
})
}
if (
@@ -190,6 +186,19 @@ export const getSHAForPushEvent = async (
previousSha = await getParentSha({
cwd: workingDirectory
})
} else if (
(await verifyCommitSha({
sha: previousSha,
cwd: workingDirectory,
showAsErrorMessage: false
})) !== 0
) {
core.warning(
`Previous commit ${previousSha} is not valid. Using parent commit.`
)
previousSha = await getParentSha({
cwd: workingDirectory
})
}
if (previousSha === currentSha) {
@@ -322,7 +331,7 @@ export const getSHAForPullRequestEvent = async (
}
await verifyCommitSha({sha: currentSha, cwd: workingDirectory})
core.info(`Previous SHA: ${previousSha}`)
core.debug(`Previous SHA: ${previousSha}`)
return {
previousSha,