Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Bogdan Stanga committed Nov 21, 2024
1 parent 5b2a03f commit cea0eaf
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions src/pull_request_comment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,25 +60,27 @@ export async function handlePullRequestComment() {
return;
}

// Run prompt
const response = await runReviewCommentPrompt({
commentThread,
commentFileDiff,
});

if (response.action_requested && response.response_comment.length) {
info("action requested, submitting response");

await octokit.pulls.createReviewComment({
...context.repo,
pull_number: pull_request.number,
commit_id: pull_request.headSha,
path: commentThread.file,
body: response.response_comment,
in_reply_to: commentThread.comments[0].id,
});
} else {
// Submit response if action requested
if (!response.action_requested || !response.response_comment.length) {
info(
"comment doesn't seem to require any action, so not submitting a response"
);
return;
}

info("action requested, submitting response");
await octokit.pulls.createReviewComment({
...context.repo,
pull_number: pull_request.number,
commit_id: pull_request.headSha,
path: commentThread.file,
body: response.response_comment,
in_reply_to: commentThread.comments[0].id,
});
}

0 comments on commit cea0eaf

Please sign in to comment.