Skip to content

Commit

Permalink
fix: prevent similar commit hashes error when using the branch name (#…
Browse files Browse the repository at this point in the history
…1745)

Co-authored-by: GitHub Action <action@github.com>
  • Loading branch information
jackton1 and actions-user authored Nov 27, 2023
1 parent c634be9 commit da093c1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 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.

4 changes: 2 additions & 2 deletions src/commitSha.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}.`
Expand Down Expand Up @@ -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}.`
Expand Down

0 comments on commit da093c1

Please sign in to comment.