fix: prevent similar commit hashes error when using the branch name
This commit is contained in:
parent
c634be959b
commit
b58dafdd29
@ -184,28 +184,6 @@ export const getSHAForNonPullRequestEvent = async (
|
|||||||
currentBranch = currentBranchName
|
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) {
|
if (!previousSha || previousSha === currentSha) {
|
||||||
core.debug('Getting previous SHA...')
|
core.debug('Getting previous SHA...')
|
||||||
if (inputs.since) {
|
if (inputs.since) {
|
||||||
@ -405,28 +383,6 @@ export const getSHAForPullRequestEvent = async (
|
|||||||
})
|
})
|
||||||
let diff = '...'
|
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 (
|
if (
|
||||||
!github.context.payload.pull_request?.base?.ref ||
|
!github.context.payload.pull_request?.base?.ref ||
|
||||||
github.context.payload.head?.repo?.fork === 'true'
|
github.context.payload.head?.repo?.fork === 'true'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user