Skip to content

Commit

Permalink
chore: update check (#1555)
Browse files Browse the repository at this point in the history
Co-authored-by: GitHub Action <action@github.com>
  • Loading branch information
jackton1 and actions-user authored Sep 9, 2023
1 parent 523e8b6 commit 81bb5d8
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 7 deletions.
17 changes: 14 additions & 3 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

19 changes: 16 additions & 3 deletions src/commitSha.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
)
Expand Down

0 comments on commit 81bb5d8

Please sign in to comment.