Skip to content

Commit

Permalink
also add the mew file
Browse files Browse the repository at this point in the history
  • Loading branch information
Bogdan Stanga committed Nov 20, 2024
1 parent 7d7f1dd commit 17e51a5
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions src/pull_request_comment.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { info, warning } from "@actions/core";
import { loadContext } from "./context";
import config from "./config";
import { initOctokit } from "./octokit";
import { COMMENT_SIGNATURE } from "./messages";

export async function handlePullRequestComment() {
const context = await loadContext();
if (context.eventName !== "pull_request_review_comment") {
warning("unsupported github event");
return;
}

const { comment, pull_request } = context.payload;
if (!comment) {
warning("`comment` is missing from payload");
return;
}
if (context.payload.action !== "created") {
warning("only consider newly created comments");
return;
}
if (!pull_request) {
warning("`pull_request` is missing from payload");
return;
}
if (isOwnComment(comment.body)) {
info("ignoring own comments");
return;
}

// TODO: implement
}

function isOwnComment(comment: string): boolean {
return comment.includes(COMMENT_SIGNATURE);
}

0 comments on commit 17e51a5

Please sign in to comment.