Skip to content

Commit

Permalink
remove unnecessary logging
Browse files Browse the repository at this point in the history
  • Loading branch information
villesau committed Apr 22, 2023
1 parent 6454621 commit cc41538
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 17 deletions.
8 changes: 0 additions & 8 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,17 +201,11 @@ function main() {
return __awaiter(this, void 0, void 0, function* () {
const prDetails = yield getPRDetails();
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"));
console.log("Event data:");
console.log(eventData);
if (eventData.action === "opened") {
console.log("Pull request event");
diff = yield getDiff(prDetails.owner, prDetails.repo, prDetails.pull_number);
}
else if (eventData.action === "synchronize") {
console.log("Push event");
console.log(eventData);
const newBaseSha = eventData.before;
const newHeadSha = eventData.after;
const response = yield octokit.repos.compareCommits({
Expand All @@ -225,8 +219,6 @@ function main() {
.request({ url: response.data.diff_url })
.then((res) => res.data)
: null;
console.log("Diff:");
console.log(diff);
}
else {
console.log("Unsupported event:", process.env.GITHUB_EVENT_NAME);
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

9 changes: 1 addition & 8 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,22 +196,17 @@ async function createReviewComment(
async function main() {
const prDetails = await getPRDetails();
let diff: string | null;
console.log("Running the action...");
const eventData = JSON.parse(
readFileSync(process.env.GITHUB_EVENT_PATH ?? "", "utf8")
);
console.log("Event data:");
console.log(eventData);

if (eventData.action === "opened") {
console.log("Pull request event");
diff = await getDiff(
prDetails.owner,
prDetails.repo,
prDetails.pull_number
);
} else if (eventData.action === "synchronize") {
console.log("Push event");
console.log(eventData);
const newBaseSha = eventData.before;
const newHeadSha = eventData.after;

Expand All @@ -227,8 +222,6 @@ async function main() {
.request({ url: response.data.diff_url })
.then((res) => res.data)
: null;
console.log("Diff:");
console.log(diff);
} else {
console.log("Unsupported event:", process.env.GITHUB_EVENT_NAME);
return;
Expand Down

0 comments on commit cc41538

Please sign in to comment.