3
0
Fork 0
mirror of https://github.com/tj-actions/changed-files synced 2025-02-06 09:41:22 +00:00

fix: prevent similar commit hashes error when using the branch name (#1745)

Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
Tonye Jack 2023-11-27 01:36:29 -07:00 committed by GitHub
parent c634be959b
commit da093c1609
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 5 deletions

4
dist/index.js generated vendored
View file

@ -997,7 +997,7 @@ const getSHAForNonPullRequestEvent = (inputs, env, workingDirectory, isShallow,
targetBranch = currentBranchName;
currentBranch = currentBranchName;
}
if (previousSha && currentSha && currentBranch && targetBranch) {
if (inputs.baseSha && inputs.sha && 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}.`);
@ -1180,7 +1180,7 @@ const getSHAForPullRequestEvent = (inputs, env, workingDirectory, isShallow, has
token: inputs.token
});
let diff = '...';
if (previousSha && currentSha && currentBranch && targetBranch) {
if (inputs.baseSha && inputs.sha && 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}.`);

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View file

@ -184,7 +184,7 @@ export const getSHAForNonPullRequestEvent = async (
currentBranch = currentBranchName
}
if (previousSha && currentSha && currentBranch && targetBranch) {
if (inputs.baseSha && inputs.sha && currentBranch && targetBranch) {
if (previousSha === currentSha) {
core.error(
`Similar commit hashes detected: previous sha: ${previousSha} is equivalent to the current sha: ${currentSha}.`
@ -405,7 +405,7 @@ export const getSHAForPullRequestEvent = async (
})
let diff = '...'
if (previousSha && currentSha && currentBranch && targetBranch) {
if (inputs.baseSha && inputs.sha && currentBranch && targetBranch) {
if (previousSha === currentSha) {
core.error(
`Similar commit hashes detected: previous sha: ${previousSha} is equivalent to the current sha: ${currentSha}.`