mirror of
https://github.com/freeedcom/ai-codereviewer.git
synced 2025-04-22 02:26:48 +00:00
chore: add language option to action.yml and use it in createPrompt.ts
This commit is contained in:
parent
c30f272ef1
commit
cf3ec6c3e2
2 changed files with 8 additions and 1 deletions
|
@ -11,6 +11,10 @@ inputs:
|
||||||
description: "OpenAI API model."
|
description: "OpenAI API model."
|
||||||
required: false
|
required: false
|
||||||
default: "gpt-4"
|
default: "gpt-4"
|
||||||
|
language:
|
||||||
|
description: "Natural language for the code review comments."
|
||||||
|
required: false
|
||||||
|
default: "english"
|
||||||
exclude:
|
exclude:
|
||||||
description: "Glob patterns to exclude files from the diff analysis"
|
description: "Glob patterns to exclude files from the diff analysis"
|
||||||
required: false
|
required: false
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import {Chunk, File} from "parse-diff";
|
import {Chunk, File} from "parse-diff";
|
||||||
|
import * as core from "@actions/core";
|
||||||
|
|
||||||
export interface PRDetails {
|
export interface PRDetails {
|
||||||
owner: string;
|
owner: string;
|
||||||
|
@ -8,11 +9,13 @@ export interface PRDetails {
|
||||||
description: string;
|
description: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const language: string = core.getInput("language");
|
||||||
|
|
||||||
export function createPrompt(file: File, chunk: Chunk, prDetails: PRDetails): string {
|
export function createPrompt(file: File, chunk: Chunk, prDetails: PRDetails): string {
|
||||||
return `Your task is to review pull requests. Instructions:
|
return `Your task is to review pull requests. Instructions:
|
||||||
- Provide the response in following JSON format: {"reviews": [{"lineNumber": <line_number>, "reviewComment": "<review comment>"}]}
|
- Provide the response in following JSON format: {"reviews": [{"lineNumber": <line_number>, "reviewComment": "<review comment>"}]}
|
||||||
- Do not give positive comments or compliments.
|
- Do not give positive comments or compliments.
|
||||||
- Provide review in Korean language.
|
- Provide review in ${language} language.
|
||||||
- Provide comments and suggestions ONLY if there is something to improve, otherwise "reviews" should be an empty array.
|
- Provide comments and suggestions ONLY if there is something to improve, otherwise "reviews" should be an empty array.
|
||||||
- Write the comment in GitHub Markdown format.
|
- Write the comment in GitHub Markdown format.
|
||||||
- Use the given description only for the overall context and only comment the code.
|
- Use the given description only for the overall context and only comment the code.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue