mirror of
https://github.com/tj-actions/changed-files
synced 2025-03-06 05:17:44 +00:00
fix: update previos sha for forks (#2011)
Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
parent
6354e6c542
commit
f0e7702ccc
4 changed files with 11 additions and 7 deletions
7
dist/index.js
generated
vendored
7
dist/index.js
generated
vendored
|
@ -1107,7 +1107,7 @@ const getSHAForNonPullRequestEvent = (_j) => __awaiter(void 0, [_j], void 0, fun
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
exports.getSHAForNonPullRequestEvent = getSHAForNonPullRequestEvent;
|
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;
|
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;
|
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;
|
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 {
|
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;
|
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 {
|
else {
|
||||||
|
@ -1773,7 +1773,8 @@ const getChangedFilesFromLocalGitHistory = (_a) => __awaiter(void 0, [_a], void
|
||||||
isShallow,
|
isShallow,
|
||||||
hasSubmodule,
|
hasSubmodule,
|
||||||
gitFetchExtraArgs,
|
gitFetchExtraArgs,
|
||||||
remoteName
|
remoteName,
|
||||||
|
isFork
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (diffResult.initialCommit) {
|
if (diffResult.initialCommit) {
|
||||||
|
|
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
|
@ -326,6 +326,7 @@ interface SHAForPullRequestEvent {
|
||||||
hasSubmodule: boolean
|
hasSubmodule: boolean
|
||||||
gitFetchExtraArgs: string[]
|
gitFetchExtraArgs: string[]
|
||||||
remoteName: string
|
remoteName: string
|
||||||
|
isFork: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getSHAForPullRequestEvent = async ({
|
export const getSHAForPullRequestEvent = async ({
|
||||||
|
@ -334,7 +335,8 @@ export const getSHAForPullRequestEvent = async ({
|
||||||
isShallow,
|
isShallow,
|
||||||
hasSubmodule,
|
hasSubmodule,
|
||||||
gitFetchExtraArgs,
|
gitFetchExtraArgs,
|
||||||
remoteName
|
remoteName,
|
||||||
|
isFork
|
||||||
}: SHAForPullRequestEvent): Promise<DiffResult> => {
|
}: SHAForPullRequestEvent): Promise<DiffResult> => {
|
||||||
let targetBranch = github.context.payload.pull_request?.base?.ref
|
let targetBranch = github.context.payload.pull_request?.base?.ref
|
||||||
const currentBranch = github.context.payload.pull_request?.head?.ref
|
const currentBranch = github.context.payload.pull_request?.head?.ref
|
||||||
|
@ -505,7 +507,7 @@ export const getSHAForPullRequestEvent = async ({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (github.context.payload.action === 'closed') {
|
if (github.context.payload.action === 'closed' || isFork) {
|
||||||
previousSha = github.context.payload.pull_request?.base?.sha
|
previousSha = github.context.payload.pull_request?.base?.sha
|
||||||
} else {
|
} else {
|
||||||
previousSha = await getRemoteBranchHeadSha({
|
previousSha = await getRemoteBranchHeadSha({
|
||||||
|
|
|
@ -118,7 +118,8 @@ const getChangedFilesFromLocalGitHistory = async ({
|
||||||
isShallow,
|
isShallow,
|
||||||
hasSubmodule,
|
hasSubmodule,
|
||||||
gitFetchExtraArgs,
|
gitFetchExtraArgs,
|
||||||
remoteName
|
remoteName,
|
||||||
|
isFork
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue