chore: update check (#1555)

Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
Tonye Jack
2023-09-08 19:39:42 -06:00
committed by GitHub
parent 523e8b6f11
commit 81bb5d8954
3 changed files with 31 additions and 7 deletions

View File

@@ -437,15 +437,28 @@ export const getSHAForPullRequestEvent = async (
github.context.payload.action &&
github.context.payload.action === 'synchronize' &&
previousSha &&
(await verifyCommitSha({sha: previousSha, cwd: workingDirectory})) !==
0
(!previousSha ||
(previousSha &&
(await verifyCommitSha({
sha: previousSha,
cwd: workingDirectory,
showAsErrorMessage: false
})) !== 0))
) {
throw new Error(
'Unable to locate the previous commit in the local history. Please ensure to checkout pull request HEAD commit instead of the merge commit. See: https://github.com/actions/checkout/blob/main/README.md#checkout-pull-request-head-commit-instead-of-merge-commit'
)
}
if (!previousSha) {
if (
!previousSha ||
(previousSha &&
(await verifyCommitSha({
sha: previousSha,
cwd: workingDirectory,
showAsErrorMessage: false
})) !== 0)
) {
throw new Error(
'Unable to locate the previous commit in the local history. Please ensure to checkout pull request HEAD commit instead of the merge commit. See: https://github.com/actions/checkout/blob/main/README.md#checkout-pull-request-head-commit-instead-of-merge-commit'
)