attempt to fix the malformed request

This commit is contained in:
Ville Saukkonen 2023-04-22 17:08:29 +03:00
parent 903cfb745e
commit dbf427f89f
3 changed files with 22 additions and 13 deletions

17
dist/index.js vendored

@ -211,23 +211,28 @@ function main() {
return __awaiter(this, void 0, void 0, function* () {
const prDetails = yield getPRDetails();
const { baseSha, headSha } = yield getBaseAndHeadShas(prDetails.owner, prDetails.repo, prDetails.pull_number);
let diffUrl;
let diff;
if (process.env.GITHUB_EVENT_NAME === "pull_request") {
diffUrl = yield getDiff(prDetails.owner, prDetails.repo, prDetails.pull_number);
diff = yield getDiff(prDetails.owner, prDetails.repo, prDetails.pull_number);
}
else if (process.env.GITHUB_EVENT_NAME === "push") {
diffUrl = yield getChangedFiles(prDetails.owner, prDetails.repo, baseSha, headSha);
const diffUrl = yield getChangedFiles(prDetails.owner, prDetails.repo, baseSha, headSha);
if (diffUrl) {
const diffResponse = yield octokit.request({ url: diffUrl });
diff = diffResponse.data;
}
else {
diff = null;
}
}
else {
console.log("Unsupported event:", process.env.GITHUB_EVENT_NAME);
return;
}
if (!diffUrl) {
if (!diff) {
console.log("No diff found");
return;
}
const diffResponse = yield octokit.request({ url: diffUrl });
const diff = diffResponse.data;
const parsedDiff = (0, parse_diff_1.default)(diff);
const excludePatterns = core
.getInput("exclude")

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

@ -216,33 +216,37 @@ async function main() {
prDetails.pull_number
);
let diffUrl: string | null;
let diff: string | null;
if (process.env.GITHUB_EVENT_NAME === "pull_request") {
diffUrl = await getDiff(
diff = await getDiff(
prDetails.owner,
prDetails.repo,
prDetails.pull_number
);
} else if (process.env.GITHUB_EVENT_NAME === "push") {
diffUrl = await getChangedFiles(
const diffUrl = await getChangedFiles(
prDetails.owner,
prDetails.repo,
baseSha,
headSha
);
if (diffUrl) {
const diffResponse = await octokit.request({ url: diffUrl });
diff = diffResponse.data;
} else {
diff = null;
}
} else {
console.log("Unsupported event:", process.env.GITHUB_EVENT_NAME);
return;
}
if (!diffUrl) {
if (!diff) {
console.log("No diff found");
return;
}
const diffResponse = await octokit.request({ url: diffUrl });
const diff = diffResponse.data;
const parsedDiff = parseDiff(diff);
const excludePatterns = core