From b58dafdd29547436d6c1996030b69b6d0ba8219f Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Mon, 27 Nov 2023 01:06:01 -0700 Subject: [PATCH] fix: prevent similar commit hashes error when using the branch name --- src/commitSha.ts | 44 -------------------------------------------- 1 file changed, 44 deletions(-) diff --git a/src/commitSha.ts b/src/commitSha.ts index 387cc693..848e75de 100644 --- a/src/commitSha.ts +++ b/src/commitSha.ts @@ -184,28 +184,6 @@ export const getSHAForNonPullRequestEvent = async ( currentBranch = currentBranchName } - if (previousSha && currentSha && currentBranch && targetBranch) { - if (previousSha === currentSha) { - core.error( - `Similar commit hashes detected: previous sha: ${previousSha} is equivalent to the current sha: ${currentSha}.` - ) - core.error( - `Please verify that both commits are valid, and increase the fetch_depth to a number higher than ${inputs.fetchDepth}.` - ) - throw new Error('Similar commit hashes detected.') - } - - core.debug(`Previous SHA: ${previousSha}`) - - return { - previousSha, - currentSha, - currentBranch, - targetBranch, - diff - } - } - if (!previousSha || previousSha === currentSha) { core.debug('Getting previous SHA...') if (inputs.since) { @@ -405,28 +383,6 @@ export const getSHAForPullRequestEvent = async ( }) let diff = '...' - if (previousSha && currentSha && currentBranch && targetBranch) { - if (previousSha === currentSha) { - core.error( - `Similar commit hashes detected: previous sha: ${previousSha} is equivalent to the current sha: ${currentSha}.` - ) - core.error( - `Please verify that both commits are valid, and increase the fetch_depth to a number higher than ${inputs.fetchDepth}.` - ) - throw new Error('Similar commit hashes detected.') - } - - core.debug(`Previous SHA: ${previousSha}`) - - return { - previousSha, - currentSha, - currentBranch, - targetBranch, - diff - } - } - if ( !github.context.payload.pull_request?.base?.ref || github.context.payload.head?.repo?.fork === 'true'