Skip to content

Commit

Permalink
fix: update previos sha for forks
Browse files Browse the repository at this point in the history
  • Loading branch information
jackton1 committed Mar 26, 2024
1 parent 6354e6c commit f2d7ea6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/commitSha.ts
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ interface SHAForPullRequestEvent {
hasSubmodule: boolean
gitFetchExtraArgs: string[]
remoteName: string
isFork: boolean
}

export const getSHAForPullRequestEvent = async ({
Expand All @@ -334,7 +335,8 @@ export const getSHAForPullRequestEvent = async ({
isShallow,
hasSubmodule,
gitFetchExtraArgs,
remoteName
remoteName,
isFork
}: SHAForPullRequestEvent): Promise<DiffResult> => {
let targetBranch = github.context.payload.pull_request?.base?.ref
const currentBranch = github.context.payload.pull_request?.head?.ref
Expand Down Expand Up @@ -505,7 +507,7 @@ export const getSHAForPullRequestEvent = async ({
}
}
} else {
if (github.context.payload.action === 'closed') {
if (github.context.payload.action === 'closed' || isFork) {
previousSha = github.context.payload.pull_request?.base?.sha
} else {
previousSha = await getRemoteBranchHeadSha({
Expand Down
3 changes: 2 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ const getChangedFilesFromLocalGitHistory = async ({
isShallow,
hasSubmodule,
gitFetchExtraArgs,
remoteName
remoteName,
isFork
})
}

Expand Down

0 comments on commit f2d7ea6

Please sign in to comment.