Skip to content

Commit f0e7702

Browse files
fix: update previos sha for forks (#2011)
Co-authored-by: GitHub Action <[email protected]>
1 parent 6354e6c commit f0e7702

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

dist/index.js

+4-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/commitSha.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,7 @@ interface SHAForPullRequestEvent {
326326
hasSubmodule: boolean
327327
gitFetchExtraArgs: string[]
328328
remoteName: string
329+
isFork: boolean
329330
}
330331

331332
export const getSHAForPullRequestEvent = async ({
@@ -334,7 +335,8 @@ export const getSHAForPullRequestEvent = async ({
334335
isShallow,
335336
hasSubmodule,
336337
gitFetchExtraArgs,
337-
remoteName
338+
remoteName,
339+
isFork
338340
}: SHAForPullRequestEvent): Promise<DiffResult> => {
339341
let targetBranch = github.context.payload.pull_request?.base?.ref
340342
const currentBranch = github.context.payload.pull_request?.head?.ref
@@ -505,7 +507,7 @@ export const getSHAForPullRequestEvent = async ({
505507
}
506508
}
507509
} else {
508-
if (github.context.payload.action === 'closed') {
510+
if (github.context.payload.action === 'closed' || isFork) {
509511
previousSha = github.context.payload.pull_request?.base?.sha
510512
} else {
511513
previousSha = await getRemoteBranchHeadSha({

src/main.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ const getChangedFilesFromLocalGitHistory = async ({
118118
isShallow,
119119
hasSubmodule,
120120
gitFetchExtraArgs,
121-
remoteName
121+
remoteName,
122+
isFork
122123
})
123124
}
124125

0 commit comments

Comments
 (0)