mirror of
https://github.com/freeedcom/ai-codereviewer.git
synced 2025-04-21 10:06:47 +00:00
Add support for pullrequest->labeled event
This commit is contained in:
parent
a9a064dfa1
commit
38e320dd5a
3 changed files with 1310 additions and 1308 deletions
17
src/main.ts
17
src/main.ts
|
@ -87,10 +87,9 @@ function createPrompt(file: File, chunk: Chunk, prDetails: PRDetails): string {
|
|||
- Use the given description only for the overall context and only comment the code.
|
||||
- IMPORTANT: NEVER suggest adding comments to the code.
|
||||
|
||||
Review the following code diff in the file "${
|
||||
file.to
|
||||
}" and take the pull request title and description into account when writing the response.
|
||||
|
||||
Review the following code diff in the file "${file.to
|
||||
}" and take the pull request title and description into account when writing the response.
|
||||
|
||||
Pull request title: ${prDetails.title}
|
||||
Pull request description:
|
||||
|
||||
|
@ -103,9 +102,9 @@ Git diff to review:
|
|||
\`\`\`diff
|
||||
${chunk.content}
|
||||
${chunk.changes
|
||||
// @ts-expect-error - ln and ln2 exists where needed
|
||||
.map((c) => `${c.ln ? c.ln : c.ln2} ${c.content}`)
|
||||
.join("\n")}
|
||||
// @ts-expect-error - ln and ln2 exists where needed
|
||||
.map((c) => `${c.ln ? c.ln : c.ln2} ${c.content}`)
|
||||
.join("\n")}
|
||||
\`\`\`
|
||||
`;
|
||||
}
|
||||
|
@ -188,7 +187,9 @@ async function main() {
|
|||
readFileSync(process.env.GITHUB_EVENT_PATH ?? "", "utf8")
|
||||
);
|
||||
|
||||
if (eventData.action === "opened") {
|
||||
let actionNames: string[] = ["opened", "labeled", "reopened"]
|
||||
|
||||
if (actionNames.includes(eventData.action)) {
|
||||
diff = await getDiff(
|
||||
prDetails.owner,
|
||||
prDetails.repo,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue