-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Bogdan Stanga
committed
Nov 20, 2024
1 parent
7d7f1dd
commit 17e51a5
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |