3
0
Fork 0
mirror of https://github.com/tj-actions/changed-files synced 2025-03-05 21:06:25 +00:00

fix: update previos sha for forks (#2011)

Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
Tonye Jack 2024-03-26 12:46:29 -06:00 committed by GitHub
parent 6354e6c542
commit f0e7702ccc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 11 additions and 7 deletions

7
dist/index.js generated vendored
View file

@ -1107,7 +1107,7 @@ const getSHAForNonPullRequestEvent = (_j) => __awaiter(void 0, [_j], void 0, fun
};
});
exports.getSHAForNonPullRequestEvent = getSHAForNonPullRequestEvent;
const getSHAForPullRequestEvent = (_o) => __awaiter(void 0, [_o], void 0, function* ({ inputs, workingDirectory, isShallow, hasSubmodule, gitFetchExtraArgs, remoteName }) {
const getSHAForPullRequestEvent = (_o) => __awaiter(void 0, [_o], void 0, function* ({ inputs, workingDirectory, isShallow, hasSubmodule, gitFetchExtraArgs, remoteName, isFork }) {
var _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1;
let targetBranch = (_q = (_p = github.context.payload.pull_request) === null || _p === void 0 ? void 0 : _p.base) === null || _q === void 0 ? void 0 : _q.ref;
const currentBranch = (_s = (_r = github.context.payload.pull_request) === null || _r === void 0 ? void 0 : _r.head) === null || _s === void 0 ? void 0 : _s.ref;
@ -1247,7 +1247,7 @@ const getSHAForPullRequestEvent = (_o) => __awaiter(void 0, [_o], void 0, functi
}
}
else {
if (github.context.payload.action === 'closed') {
if (github.context.payload.action === 'closed' || isFork) {
previousSha = (_x = (_w = github.context.payload.pull_request) === null || _w === void 0 ? void 0 : _w.base) === null || _x === void 0 ? void 0 : _x.sha;
}
else {
@ -1773,7 +1773,8 @@ const getChangedFilesFromLocalGitHistory = (_a) => __awaiter(void 0, [_a], void
isShallow,
hasSubmodule,
gitFetchExtraArgs,
remoteName
remoteName,
isFork
});
}
if (diffResult.initialCommit) {

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View file

@ -326,6 +326,7 @@ interface SHAForPullRequestEvent {
hasSubmodule: boolean
gitFetchExtraArgs: string[]
remoteName: string
isFork: boolean
}
export const getSHAForPullRequestEvent = async ({
@ -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
@ -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({

View file

@ -118,7 +118,8 @@ const getChangedFilesFromLocalGitHistory = async ({
isShallow,
hasSubmodule,
gitFetchExtraArgs,
remoteName
remoteName,
isFork
})
}