CI: Issue Change Requests
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user