remove unnecessary logging

This commit is contained in:
Ville Saukkonen 2023-04-22 18:06:45 +03:00
parent 6454621f44
commit cc415382f7
3 changed files with 2 additions and 17 deletions

8
dist/index.js vendored

@ -201,17 +201,11 @@ function main() {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const prDetails = yield getPRDetails(); const prDetails = yield getPRDetails();
let diff; let diff;
console.log("Running the action...");
const eventData = JSON.parse((0, fs_1.readFileSync)((_a = process.env.GITHUB_EVENT_PATH) !== null && _a !== void 0 ? _a : "", "utf8")); const eventData = JSON.parse((0, fs_1.readFileSync)((_a = process.env.GITHUB_EVENT_PATH) !== null && _a !== void 0 ? _a : "", "utf8"));
console.log("Event data:");
console.log(eventData);
if (eventData.action === "opened") { if (eventData.action === "opened") {
console.log("Pull request event");
diff = yield getDiff(prDetails.owner, prDetails.repo, prDetails.pull_number); diff = yield getDiff(prDetails.owner, prDetails.repo, prDetails.pull_number);
} }
else if (eventData.action === "synchronize") { else if (eventData.action === "synchronize") {
console.log("Push event");
console.log(eventData);
const newBaseSha = eventData.before; const newBaseSha = eventData.before;
const newHeadSha = eventData.after; const newHeadSha = eventData.after;
const response = yield octokit.repos.compareCommits({ const response = yield octokit.repos.compareCommits({
@ -225,8 +219,6 @@ function main() {
.request({ url: response.data.diff_url }) .request({ url: response.data.diff_url })
.then((res) => res.data) .then((res) => res.data)
: null; : null;
console.log("Diff:");
console.log(diff);
} }
else { else {
console.log("Unsupported event:", process.env.GITHUB_EVENT_NAME); console.log("Unsupported event:", process.env.GITHUB_EVENT_NAME);

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

@ -196,22 +196,17 @@ async function createReviewComment(
async function main() { async function main() {
const prDetails = await getPRDetails(); const prDetails = await getPRDetails();
let diff: string | null; let diff: string | null;
console.log("Running the action...");
const eventData = JSON.parse( const eventData = JSON.parse(
readFileSync(process.env.GITHUB_EVENT_PATH ?? "", "utf8") readFileSync(process.env.GITHUB_EVENT_PATH ?? "", "utf8")
); );
console.log("Event data:");
console.log(eventData);
if (eventData.action === "opened") { if (eventData.action === "opened") {
console.log("Pull request event");
diff = await getDiff( diff = await getDiff(
prDetails.owner, prDetails.owner,
prDetails.repo, prDetails.repo,
prDetails.pull_number prDetails.pull_number
); );
} else if (eventData.action === "synchronize") { } else if (eventData.action === "synchronize") {
console.log("Push event");
console.log(eventData);
const newBaseSha = eventData.before; const newBaseSha = eventData.before;
const newHeadSha = eventData.after; const newHeadSha = eventData.after;
@ -227,8 +222,6 @@ async function main() {
.request({ url: response.data.diff_url }) .request({ url: response.data.diff_url })
.then((res) => res.data) .then((res) => res.data)
: null; : null;
console.log("Diff:");
console.log(diff);
} else { } else {
console.log("Unsupported event:", process.env.GITHUB_EVENT_NAME); console.log("Unsupported event:", process.env.GITHUB_EVENT_NAME);
return; return;