diff --git a/action.yml b/action.yml index 976aed7..b4619d9 100644 --- a/action.yml +++ b/action.yml @@ -11,6 +11,10 @@ inputs: description: "OpenAI API model." required: false default: "gpt-4" + language: + description: "Natural language for the code review comments." + required: false + default: "english" exclude: description: "Glob patterns to exclude files from the diff analysis" required: false diff --git a/src/createPrompt.ts b/src/createPrompt.ts index d5fd302..5d4abdc 100644 --- a/src/createPrompt.ts +++ b/src/createPrompt.ts @@ -1,4 +1,5 @@ import {Chunk, File} from "parse-diff"; +import * as core from "@actions/core"; export interface PRDetails { owner: string; @@ -8,11 +9,13 @@ export interface PRDetails { description: string; } +const language: string = core.getInput("language"); + export function createPrompt(file: File, chunk: Chunk, prDetails: PRDetails): string { return `Your task is to review pull requests. Instructions: - Provide the response in following JSON format: {"reviews": [{"lineNumber": , "reviewComment": ""}]} - 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. - Write the comment in GitHub Markdown format. - Use the given description only for the overall context and only comment the code.