Skip to content

Commit

Permalink
chore(action): fixed issue with var
Browse files Browse the repository at this point in the history
  • Loading branch information
DarrellRichards committed Jun 3, 2024
1 parent 0a8671d commit 9219d7c
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 17 deletions.
48 changes: 34 additions & 14 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ async function validatePullRequest(diff: File[], details: Details) {

if (foundSummary && foundSummary.length > 0) {
const bodyIdea = await summaryAllMessages(foundSummary);
console.log('Summary of all messages', bodyIdea);
return bodyIdea;
}

Expand Down Expand Up @@ -175,23 +176,42 @@ async function main() {
await updateBody(repository.owner.login, repository.name, number, summary)
}

if (overallReview) {
const detailedFeedback = await validateOverallCodeReview(filteredDiff, {
title,
description
});
// if (overallReview) {
// const detailedFeedback = await validateOverallCodeReview(filteredDiff, {
// title,
// description
// });

if (detailedFeedback && detailedFeedback.length > 0) {
const resultsFullFeedback = await summaryOfAllFeedback(detailedFeedback);
// if (detailedFeedback && detailedFeedback.length > 0) {
// const resultsFullFeedback = await summaryOfAllFeedback(detailedFeedback);

const data = await commentOnPullRequest({
owner: repository.owner.login,
repo: repository.name,
number
}, resultsFullFeedback);
// const data = await commentOnPullRequest({
// owner: repository.owner.login,
// repo: repository.name,
// number
// }, resultsFullFeedback);

// console.log('Commented on PR with full feedback', data);
// }
// }
}

console.log('Commented on PR with full feedback', data);
}
if (overallReview) {
const detailedFeedback = await validateOverallCodeReview(filteredDiff, {
title,
description
});

if (detailedFeedback && detailedFeedback.length > 0) {
const resultsFullFeedback = await summaryOfAllFeedback(detailedFeedback);

const data = await commentOnPullRequest({
owner: repository.owner.login,
repo: repository.name,
number
}, resultsFullFeedback);

console.log('Commented on PR with full feedback', data);
}
}

Expand Down
4 changes: 1 addition & 3 deletions src/services/ai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ export async function obtainFeedback(file: File, chunk: Chunk, details: Details)
- Provide a detailed feedback of the pull request based on the diff below.
- Please write the result in Github Markdown Format.
- Provide the written feedback in the following JSON format: {"feedback": [{"changesOverview": "<changesOverview>", "feedback": "<feedback", "improvements", "<improvements>", "conclusion": "<conclusion>"}]}.
Review the following code diff in the files "${file.to}", and take the pull request title: ${details.title} into account when writing your response.
Expand Down Expand Up @@ -126,12 +125,11 @@ export async function obtainFeedback(file: File, chunk: Chunk, details: Details)
}

export async function summaryOfAllFeedback(feedbacks: any[]) {
console.log('feedbacks', feedbacks);
const systemMessage = `
Your requirement is to merge all the feedbacks into one feedback.
Instructions below:
- Please write the result in Github Markdown Format.
- Provide the written feedback written as a Github Comment format.
- Provide the written feedback as a Github Pull Request Body.
- Please format each header as a H2 header.
`
const message = `
Expand Down

0 comments on commit 9219d7c

Please sign in to comment.