3
0
Fork 0
mirror of https://github.com/tj-actions/changed-files synced 2025-02-21 05:28:14 +00:00

fix: bug returning empty output for pull request close event (#1556)

Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
Tonye Jack 2023-09-08 21:02:46 -06:00 committed by GitHub
parent fe0fb71961
commit 246636f5fa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 14 deletions

19
dist/index.js generated vendored
View file

@ -998,7 +998,7 @@ const getSHAForNonPullRequestEvent = (inputs, env, workingDirectory, isShallow,
});
exports.getSHAForNonPullRequestEvent = getSHAForNonPullRequestEvent;
const getSHAForPullRequestEvent = (inputs, env, workingDirectory, isShallow, hasSubmodule, gitFetchExtraArgs) => __awaiter(void 0, void 0, void 0, function* () {
var _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
var _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
let targetBranch = (_m = (_l = github.context.payload.pull_request) === null || _l === void 0 ? void 0 : _l.base) === null || _m === void 0 ? void 0 : _m.ref;
const currentBranch = (_p = (_o = github.context.payload.pull_request) === null || _o === void 0 ? void 0 : _o.head) === null || _p === void 0 ? void 0 : _p.ref;
if (inputs.sinceLastRemoteCommit) {
@ -1135,13 +1135,18 @@ const getSHAForPullRequestEvent = (inputs, env, workingDirectory, isShallow, has
}
}
else {
previousSha = yield (0, utils_1.getRemoteBranchHeadSha)({
cwd: workingDirectory,
branch: targetBranch
});
if (!previousSha) {
if (github.context.payload.action === 'closed') {
previousSha = (_w = (_v = github.context.payload.pull_request) === null || _v === void 0 ? void 0 : _v.base) === null || _w === void 0 ? void 0 : _w.sha;
}
else {
previousSha = yield (0, utils_1.getRemoteBranchHeadSha)({
cwd: workingDirectory,
branch: targetBranch
});
if (!previousSha) {
previousSha = (_y = (_x = github.context.payload.pull_request) === null || _x === void 0 ? void 0 : _x.base) === null || _y === void 0 ? void 0 : _y.sha;
}
}
if (isShallow) {
if (!(yield (0, utils_1.canDiffCommits)({
cwd: workingDirectory,
@ -1177,7 +1182,7 @@ const getSHAForPullRequestEvent = (inputs, env, workingDirectory, isShallow, has
}
}
if (!previousSha || previousSha === currentSha) {
previousSha = (_y = (_x = github.context.payload.pull_request) === null || _x === void 0 ? void 0 : _x.base) === null || _y === void 0 ? void 0 : _y.sha;
previousSha = (_0 = (_z = github.context.payload.pull_request) === null || _z === void 0 ? void 0 : _z.base) === null || _0 === void 0 ? void 0 : _0.sha;
}
}
if (!(yield (0, utils_1.canDiffCommits)({

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View file

@ -465,13 +465,17 @@ export const getSHAForPullRequestEvent = async (
}
}
} else {
previousSha = await getRemoteBranchHeadSha({
cwd: workingDirectory,
branch: targetBranch
})
if (!previousSha) {
if (github.context.payload.action === 'closed') {
previousSha = github.context.payload.pull_request?.base?.sha
} else {
previousSha = await getRemoteBranchHeadSha({
cwd: workingDirectory,
branch: targetBranch
})
if (!previousSha) {
previousSha = github.context.payload.pull_request?.base?.sha
}
}
if (isShallow) {