oqtane-general-description #62
@@ -86,14 +86,15 @@ func main() {
|
||||
}
|
||||
|
||||
if len(reviews) > 0 {
|
||||
commentBody := "### 🤖 Gemini Writing Review\n\n" + strings.Join(reviews, "\n\n---\n\n")
|
||||
_, _, err = client.CreateIssueComment(owner, repo, prNumber, gitea.CreateIssueCommentOption{
|
||||
Body: commentBody,
|
||||
reviewBody := "### 🤖 Gemini Writing Review\n\n" + strings.Join(reviews, "\n\n---\n\n")
|
||||
_, _, err = client.CreatePullReview(owner, repo, prNumber, gitea.CreatePullReviewOptions{
|
||||
State: gitea.ReviewStateRequestChanges,
|
||||
Body: reviewBody,
|
||||
})
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to post PR comment: %v", err)
|
||||
log.Fatalf("Failed to create PR review: %v", err)
|
||||
}
|
||||
fmt.Println("Successfully posted review comments.")
|
||||
fmt.Println("Successfully created PR change request review.")
|
||||
} else {
|
||||
fmt.Println("No Markdown files to review or no suggestions found.")
|
||||
}
|
||||
@@ -116,11 +117,13 @@ func readFile(path string) (string, error) {
|
||||
func getGeminiReview(ctx context.Context, model *genai.GenerativeModel, content string) (string, error) {
|
||||
prompt := fmt.Sprintf(`
|
||||
Review the following Markdown content for spelling errors, grammar mistakes, and style improvements.
|
||||
This review will be posted as a "Request Changes" on a Pull Request, so please be specific and actionable.
|
||||
Provide your feedback as a list of bullet points. For each point:
|
||||
1. Identify the issue.
|
||||
2. Provide the original text.
|
||||
3. Suggest an alternative or fix.
|
||||
4. Check the content on completeness and correctness.
|
||||
2. Provide the original text snippet.
|
||||
3. Suggest a clear alternative or fix.
|
||||
4. Briefly explain why the change is necessary if not obvious.
|
||||
5. Check the content for completeness and technical correctness.
|
||||
|
||||
Content:
|
||||
%s
|
||||
|
||||
@@ -17,8 +17,8 @@ func main() {
|
||||
repoFullName := os.Getenv("GITHUB_REPOSITORY")
|
||||
prNumberStr := os.Getenv("PR_NUMBER")
|
||||
|
||||
if token == "" || prNumberStr == "" {
|
||||
log.Fatal("Missing required environment variables: GEMINI_API_KEY, GITEA_TOKEN, GITHUB_REPOSITORY, PR_NUMBER")
|
||||
if token == "" || repoFullName == "" || prNumberStr == "" {
|
||||
log.Fatal("Missing required environment variables: GITEA_TOKEN, GITHUB_REPOSITORY, PR_NUMBER")
|
||||
}
|
||||
|
||||
if baseURL == "" {
|
||||
@@ -65,7 +65,7 @@ func main() {
|
||||
}
|
||||
|
||||
if len(counts) > 0 {
|
||||
commentBody := "### 🤖 Gemini Writing Review\n\n" + strings.Join(counts, "\n\n---\n\n")
|
||||
commentBody := "### 🤖 Word Count Report\n\n" + strings.Join(counts, "\n\n---\n\n")
|
||||
_, _, err = client.CreateIssueComment(owner, repo, prNumber, gitea.CreateIssueCommentOption{
|
||||
Body: commentBody,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user